Skip to content

Commit

Permalink
Add Pod to all Local::Rx modules in xt/lib
Browse files Browse the repository at this point in the history
  • Loading branch information
briandfoy committed Nov 25, 2024
1 parent 2f12813 commit bbb7780
Show file tree
Hide file tree
Showing 7 changed files with 499 additions and 0 deletions.
66 changes: 66 additions & 0 deletions xt/lib/Local/Rx.pm
Original file line number Diff line number Diff line change
@@ -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<Data::Rx>:
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<xt/lib> 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<Data::Rx>
=cut

=head1 SOURCE AVAILABILITY
Although this module may come with your L<CPANSA::DB> 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<< <[email protected]> >>
=head1 COPYRIGHT AND LICENSE
Copyright © 2024, brian d foy C<< <[email protected]> >>. All rights reserved.
This software is available under the Artistic License 2.0.
=cut

package # hide from PAUSE
Local::Rx;

Expand Down
74 changes: 74 additions & 0 deletions xt/lib/Local/Rx/Type/CVE.pm
Original file line number Diff line number Diff line change
@@ -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<Data::Rx>:
use Data::Rx;
use Local::Rx::Type::CVE;
Data::Rx->new({
type_plugins => [qw(
Local::Rx::Type::CVE
)],
});
This is automatically loaded in C<Local::Rx>:
use FindBin qw($RealBin);
use lib "$RealBin/lib";
my $rx = Local::Rx->new;
In your Rx specification, use the tag C<tag:example.com,EXAMPLE:rx/cve>:
my $rx = {
type => '//rec',
required => {
cve => { type => 'tag:example.com,EXAMPLE:rx/cve', },
},
...
};
=head1 DESCRIPTION
This is a user-defined type for L<Data::Rx> 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<Data::Rx::CommonType::EasyNew>
=item * L<Data::Rx>
=item * L<https://rx.codesimply.com/>
=item * L<https://www.cve.org>
=cut

=head1 SOURCE AVAILABILITY
Although this module may come with your L<CPANSA::DB> 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<< <[email protected]> >>
=head1 COPYRIGHT AND LICENSE
Copyright © 2024, brian d foy C<< <[email protected]> >>. 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';
Expand Down
71 changes: 71 additions & 0 deletions xt/lib/Local/Rx/Type/CommitID.pm
Original file line number Diff line number Diff line change
@@ -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<Data::Rx>:
use Data::Rx;
use Local::Rx::Type::CommitID;
Data::Rx->new({
type_plugins => [qw(
Local::Rx::Type::CommitID
)],
});
This is automatically loaded in C<Local::Rx>:
use FindBin qw($RealBin);
use lib "$RealBin/lib";
my $rx = Local::Rx->new;
In your Rx specification, use the tag C<tag:example.com,EXAMPLE:rx/commit-id>:
my $rx = {
type => '//rec',
required => {
commit => { type => 'tag:example.com,EXAMPLE:rx/commit-id', },
},
...
};
=head1 DESCRIPTION
This is a user-defined type for L<Data::Rx> 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<Data::Rx::CommonType::EasyNew>
=item * L<Data::Rx>
=item * L<https://rx.codesimply.com/>
=cut

=head1 SOURCE AVAILABILITY
Although this module may come with your L<CPANSA::DB> 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<< <[email protected]> >>
=head1 COPYRIGHT AND LICENSE
Copyright © 2024, brian d foy C<< <[email protected]> >>. 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';
Expand Down
73 changes: 73 additions & 0 deletions xt/lib/Local/Rx/Type/GHSA.pm
Original file line number Diff line number Diff line change
@@ -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<Data::Rx>:
use Data::Rx;
use Local::Rx::Type::GHSA;
Data::Rx->new({
type_plugins => [qw(
Local::Rx::Type::GHSA
)],
});
This is automatically loaded in C<Local::Rx>:
use FindBin qw($RealBin);
use lib "$RealBin/lib";
my $rx = Local::Rx->new;
In your Rx specification, use the tag C<tag:example.com,EXAMPLE:rx/ghsa>:
my $rx = {
type => '//rec',
required => {
commit => { type => 'tag:example.com,EXAMPLE:rx/ghsa', },
},
...
};
=head1 DESCRIPTION
This is a user-defined type for L<Data::Rx> that checks that a value
looks like a GitHub Advisory Database ID, such as C<GHSA-hm5v-6984-hfqp>.
=head1 SEE ALSO
=over 4
=item * L<Data::Rx::CommonType::EasyNew>
=item * L<Data::Rx>
=item * L<https://rx.codesimply.com/>
=item * L<https://github.com/advisories>
=cut

=head1 SOURCE AVAILABILITY
Although this module may come with your L<CPANSA::DB> 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<< <[email protected]> >>
=head1 COPYRIGHT AND LICENSE
Copyright © 2024, brian d foy C<< <[email protected]> >>. 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';
Expand Down
72 changes: 72 additions & 0 deletions xt/lib/Local/Rx/Type/URL.pm
Original file line number Diff line number Diff line change
@@ -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<Data::Rx>:
use Data::Rx;
use Local::Rx::Type::URL;
Data::Rx->new({
type_plugins => [qw(
Local::Rx::Type::URL
)],
});
This is automatically loaded in C<Local::Rx>:
use FindBin qw($RealBin);
use lib "$RealBin/lib";
my $rx = Local::Rx->new;
In your Rx specification, use the tag C<tag:example.com,EXAMPLE:rx/url>:
my $rx = {
type => '//rec',
required => {
commit => { type => 'tag:example.com,EXAMPLE:rx/url', },
},
...
};
=head1 DESCRIPTION
This is a user-defined type for L<Data::Rx> 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<Data::Rx::CommonType::EasyNew>
=item * L<Data::Rx>
=item * L<https://rx.codesimply.com/>
=cut

=head1 SOURCE AVAILABILITY
Although this module may come with your L<CPANSA::DB> 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<< <[email protected]> >>
=head1 COPYRIGHT AND LICENSE
Copyright © 2024, brian d foy C<< <[email protected]> >>. 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';
Expand Down
Loading

0 comments on commit bbb7780

Please sign in to comment.