From bbb77808d4e38d26a8849fc02a34143c2a23fabf Mon Sep 17 00:00:00 2001 From: brian d foy Date: Mon, 25 Nov 2024 17:49:02 -0500 Subject: [PATCH] Add Pod to all Local::Rx modules in xt/lib --- xt/lib/Local/Rx.pm | 66 ++++++++++++++++++++++++++++ xt/lib/Local/Rx/Type/CVE.pm | 74 ++++++++++++++++++++++++++++++++ xt/lib/Local/Rx/Type/CommitID.pm | 71 ++++++++++++++++++++++++++++++ xt/lib/Local/Rx/Type/GHSA.pm | 73 +++++++++++++++++++++++++++++++ xt/lib/Local/Rx/Type/URL.pm | 72 +++++++++++++++++++++++++++++++ xt/lib/Local/Rx/Type/VCS_URL.pm | 72 +++++++++++++++++++++++++++++++ xt/lib/Local/Rx/Type/YYYYMMDD.pm | 71 ++++++++++++++++++++++++++++++ 7 files changed, 499 insertions(+) diff --git a/xt/lib/Local/Rx.pm b/xt/lib/Local/Rx.pm index 851a72b..ed65347 100644 --- a/xt/lib/Local/Rx.pm +++ b/xt/lib/Local/Rx.pm @@ -1,3 +1,69 @@ +=head1 NAME + +Local::Rx - a convenient way to load Data::Rx with all the local types + +=head1 SYNOPSIS + +This is a user-defined type for L: + + use FindBin qw($RealBin); + use lib "$RealBin/lib"; + + my $rx = Local::Rx->new; + + ... use $rx as you would in Data::Rx ... + +=head1 DESCRIPTION + +This loads all the local types so you don't have to. These modules +are all in F so far. + +=head2 Types + +=over 4 + +=item * Local::Rx::Type::CommitID + +=item * Local::Rx::Type::CVE + +=item * Local::Rx::Type::GHSA + +=item * Local::Rx::Type::URL + +=item * Local::Rx::Type::VCS_URL + +=item * Local::Rx::Type::YYYYMMDD + +=back + +=head1 SEE ALSO + +=over 4 + +=item * L + +=cut + +=head1 SOURCE AVAILABILITY + +Although this module may come with your L distribution, +it is not indexed by PAUSE. + +This module is on Github: + + https://github.com/briandfoy/cpan-security-advisories + +=head1 AUTHOR + +brian d foy, C<< >> + +=head1 COPYRIGHT AND LICENSE + +Copyright © 2024, brian d foy C<< >>. All rights reserved. +This software is available under the Artistic License 2.0. + +=cut + package # hide from PAUSE Local::Rx; diff --git a/xt/lib/Local/Rx/Type/CVE.pm b/xt/lib/Local/Rx/Type/CVE.pm index 6303ac2..96e90b6 100644 --- a/xt/lib/Local/Rx/Type/CVE.pm +++ b/xt/lib/Local/Rx/Type/CVE.pm @@ -1,3 +1,77 @@ +=head1 NAME + +Local::Rx::Type::CVE - a value looks like a CVE report number + +=head1 SYNOPSIS + +This is a user-defined type for L: + + use Data::Rx; + use Local::Rx::Type::CVE; + + Data::Rx->new({ + type_plugins => [qw( + Local::Rx::Type::CVE + )], + }); + +This is automatically loaded in C: + + use FindBin qw($RealBin); + use lib "$RealBin/lib"; + + my $rx = Local::Rx->new; + +In your Rx specification, use the tag C: + + my $rx = { + type => '//rec', + required => { + cve => { type => 'tag:example.com,EXAMPLE:rx/cve', }, + }, + ... + }; + +=head1 DESCRIPTION + +This is a user-defined type for L that checks that a value +looks like a Common Vulnerabilities and Exposures (CVE) report number. +That's typically the year followed by a dash then a decimal number. + +=head1 SEE ALSO + +=over 4 + +=item * L + +=item * L + +=item * L + +=item * L + +=cut + +=head1 SOURCE AVAILABILITY + +Although this module may come with your L distribution, +it is not indexed by PAUSE. + +This module is on Github: + + https://github.com/briandfoy/cpan-security-advisories + +=head1 AUTHOR + +brian d foy, C<< >> + +=head1 COPYRIGHT AND LICENSE + +Copyright © 2024, brian d foy C<< >>. All rights reserved. +This software is available under the Artistic License 2.0. + +=cut + package # hide from PAUSE Local::Rx::Type::CVE; use parent 'Data::Rx::CommonType::EasyNew'; diff --git a/xt/lib/Local/Rx/Type/CommitID.pm b/xt/lib/Local/Rx/Type/CommitID.pm index f612cbd..bf4a1ed 100644 --- a/xt/lib/Local/Rx/Type/CommitID.pm +++ b/xt/lib/Local/Rx/Type/CommitID.pm @@ -1,3 +1,74 @@ +=head1 NAME + +Local::Rx::Type::CommitID - a value looks like a git commit ID + +=head1 SYNOPSIS + +This is a user-defined type for L: + + use Data::Rx; + use Local::Rx::Type::CommitID; + + Data::Rx->new({ + type_plugins => [qw( + Local::Rx::Type::CommitID + )], + }); + +This is automatically loaded in C: + + use FindBin qw($RealBin); + use lib "$RealBin/lib"; + + my $rx = Local::Rx->new; + +In your Rx specification, use the tag C: + + my $rx = { + type => '//rec', + required => { + commit => { type => 'tag:example.com,EXAMPLE:rx/commit-id', }, + }, + ... + }; + +=head1 DESCRIPTION + +This is a user-defined type for L that checks that a value +looks like a git commit ID. So far, that's just 40 case-insensitive hex digits. + +=head1 SEE ALSO + +=over 4 + +=item * L + +=item * L + +=item * L + +=cut + +=head1 SOURCE AVAILABILITY + +Although this module may come with your L distribution, +it is not indexed by PAUSE. + +This module is on Github: + + https://github.com/briandfoy/cpan-security-advisories + +=head1 AUTHOR + +brian d foy, C<< >> + +=head1 COPYRIGHT AND LICENSE + +Copyright © 2024, brian d foy C<< >>. All rights reserved. +This software is available under the Artistic License 2.0. + +=cut + package # hide from PAUSE Local::Rx::Type::CommitID; use parent 'Data::Rx::CommonType::EasyNew'; diff --git a/xt/lib/Local/Rx/Type/GHSA.pm b/xt/lib/Local/Rx/Type/GHSA.pm index 9aa2a51..cefffe8 100644 --- a/xt/lib/Local/Rx/Type/GHSA.pm +++ b/xt/lib/Local/Rx/Type/GHSA.pm @@ -1,3 +1,76 @@ +=head1 NAME + +Local::Rx::Type::GHSA - a value looks like a GitHub Advisory Database ID + +=head1 SYNOPSIS + +This is a user-defined type for L: + + use Data::Rx; + use Local::Rx::Type::GHSA; + + Data::Rx->new({ + type_plugins => [qw( + Local::Rx::Type::GHSA + )], + }); + +This is automatically loaded in C: + + use FindBin qw($RealBin); + use lib "$RealBin/lib"; + + my $rx = Local::Rx->new; + +In your Rx specification, use the tag C: + + my $rx = { + type => '//rec', + required => { + commit => { type => 'tag:example.com,EXAMPLE:rx/ghsa', }, + }, + ... + }; + +=head1 DESCRIPTION + +This is a user-defined type for L that checks that a value +looks like a GitHub Advisory Database ID, such as C. + +=head1 SEE ALSO + +=over 4 + +=item * L + +=item * L + +=item * L + +=item * L + +=cut + +=head1 SOURCE AVAILABILITY + +Although this module may come with your L distribution, +it is not indexed by PAUSE. + +This module is on Github: + + https://github.com/briandfoy/cpan-security-advisories + +=head1 AUTHOR + +brian d foy, C<< >> + +=head1 COPYRIGHT AND LICENSE + +Copyright © 2024, brian d foy C<< >>. All rights reserved. +This software is available under the Artistic License 2.0. + +=cut + package # hide from PAUSE Local::Rx::Type::GHSA; use parent 'Data::Rx::CommonType::EasyNew'; diff --git a/xt/lib/Local/Rx/Type/URL.pm b/xt/lib/Local/Rx/Type/URL.pm index 6766cf9..8c06734 100644 --- a/xt/lib/Local/Rx/Type/URL.pm +++ b/xt/lib/Local/Rx/Type/URL.pm @@ -1,3 +1,75 @@ +=head1 NAME + +Local::Rx::Type::URL - a value looks like a URL + +=head1 SYNOPSIS + +This is a user-defined type for L: + + use Data::Rx; + use Local::Rx::Type::URL; + + Data::Rx->new({ + type_plugins => [qw( + Local::Rx::Type::URL + )], + }); + +This is automatically loaded in C: + + use FindBin qw($RealBin); + use lib "$RealBin/lib"; + + my $rx = Local::Rx->new; + +In your Rx specification, use the tag C: + + my $rx = { + type => '//rec', + required => { + commit => { type => 'tag:example.com,EXAMPLE:rx/url', }, + }, + ... + }; + +=head1 DESCRIPTION + +This is a user-defined type for L that checks that a value +looks like a URL. So far, this is not that sophisticated: it checks +that it starts with a http, https, or ftp scheme. + +=head1 SEE ALSO + +=over 4 + +=item * L + +=item * L + +=item * L + +=cut + +=head1 SOURCE AVAILABILITY + +Although this module may come with your L distribution, +it is not indexed by PAUSE. + +This module is on Github: + + https://github.com/briandfoy/cpan-security-advisories + +=head1 AUTHOR + +brian d foy, C<< >> + +=head1 COPYRIGHT AND LICENSE + +Copyright © 2024, brian d foy C<< >>. All rights reserved. +This software is available under the Artistic License 2.0. + +=cut + package # hide from PAUSE Local::Rx::Type::URL; use parent 'Data::Rx::CommonType::EasyNew'; diff --git a/xt/lib/Local/Rx/Type/VCS_URL.pm b/xt/lib/Local/Rx/Type/VCS_URL.pm index bae2423..50cdd37 100644 --- a/xt/lib/Local/Rx/Type/VCS_URL.pm +++ b/xt/lib/Local/Rx/Type/VCS_URL.pm @@ -1,3 +1,75 @@ +=head1 NAME + +Local::Rx::Type::VCS_URL - a value looks like a URL for a GitHub repo + +=head1 SYNOPSIS + +This is a user-defined type for L: + + use Data::Rx; + use Local::Rx::Type::VCS_URL; + + Data::Rx->new({ + type_plugins => [qw( + Local::Rx::Type::VCS_URL + )], + }); + +This is automatically loaded in C: + + use FindBin qw($RealBin); + use lib "$RealBin/lib"; + + my $rx = Local::Rx->new; + +In your Rx specification, use the tag C: + + my $rx = { + type => '//rec', + required => { + commit => { type => 'tag:example.com,EXAMPLE:rx/vcs-url', }, + }, + ... + }; + +=head1 DESCRIPTION + +This is a user-defined type for L that checks that a value +looks like a source control URL. So far, this is not that sophisticated: it checks +that it starts with a https, git, or svn scheme. + +=head1 SEE ALSO + +=over 4 + +=item * L + +=item * L + +=item * L + +=cut + +=head1 SOURCE AVAILABILITY + +Although this module may come with your L distribution, +it is not indexed by PAUSE. + +This module is on Github: + + https://github.com/briandfoy/cpan-security-advisories + +=head1 AUTHOR + +brian d foy, C<< >> + +=head1 COPYRIGHT AND LICENSE + +Copyright © 2024, brian d foy C<< >>. All rights reserved. +This software is available under the Artistic License 2.0. + +=cut + package # hide from PAUSE Local::Rx::Type::VCS_URL; use parent 'Data::Rx::CommonType::EasyNew'; diff --git a/xt/lib/Local/Rx/Type/YYYYMMDD.pm b/xt/lib/Local/Rx/Type/YYYYMMDD.pm index 8845984..9ae7e12 100644 --- a/xt/lib/Local/Rx/Type/YYYYMMDD.pm +++ b/xt/lib/Local/Rx/Type/YYYYMMDD.pm @@ -1,3 +1,74 @@ +=head1 NAME + +Local::Rx::Type::YYYYMMDD - a value looks like a YYYY-MM-DD date + +=head1 SYNOPSIS + +This is a user-defined type for L: + + use Data::Rx; + use Local::Rx::Type::YYYYMMDD; + + Data::Rx->new({ + type_plugins => [qw( + Local::Rx::Type::YYYYMMDD + )], + }); + +This is automatically loaded in C: + + use FindBin qw($RealBin); + use lib "$RealBin/lib"; + + my $rx = Local::Rx->new; + +In your Rx specification, use the tag C: + + my $rx = { + type => '//rec', + required => { + commit => { type => 'tag:example.com,EXAMPLE:rx/cpansa-date', }, + }, + ... + }; + +=head1 DESCRIPTION + +This is a user-defined type for L that checks that a value +looks like a date as used in CPANSA reports, which use the YYYY-MM-DD +format (even though the dashes can't appear in a Perl package name). +This does not verify that the date is valid. + +=head1 SEE ALSO + +=over 4 + +=item * L + +=item * L + +=cut + +=head1 SOURCE AVAILABILITY + +Although this module may come with your L distribution, +it is not indexed by PAUSE. + +This module is on Github: + + https://github.com/briandfoy/cpan-security-advisories + +=head1 AUTHOR + +brian d foy, C<< >> + +=head1 COPYRIGHT AND LICENSE + +Copyright © 2024, brian d foy C<< >>. All rights reserved. +This software is available under the Artistic License 2.0. + +=cut + package # hide from PAUSE Local::Rx::Type::YYYYMMDD; use parent 'Data::Rx::CommonType::EasyNew';