Algorithm-IncludeExclude
view release on metacpan or search on metacpan
inc/Module/Install/Metadata.pm view on Meta::CPAN
(?:licen[cs]e|licensing|copyright|legal)\b
(.*?)
(=head\\d.*|=cut.*|)
\z
/ixms
)
{
my $license_text = $1;
my @phrases = (
'under the same (?:terms|license) as perl itself' => 'perl',
'GNU public license' => 'gpl',
'GNU lesser public license' => 'gpl',
'BSD license' => 'bsd',
'Artistic license' => 'artistic',
'GPL' => 'gpl',
'LGPL' => 'lgpl',
'BSD' => 'bsd',
'Artistic' => 'artistic',
);
while ( my ( $pattern, $license ) = splice( @phrases, 0, 2 ) ) {
$pattern =~ s{\s+}{\\s+}g;
if ( $license_text =~ /\b$pattern\b/i ) {
lib/Algorithm/IncludeExclude.pm view on Meta::CPAN
$ie->evaluate(qw/a path.protected/); # exclude (due to regex)
$ie->evaluate(qw/foo bar/); # undefined (no rule matches)
$ie->include(qw/foo bar/);
$ie->evaluate(qw/foo bar/); # now it's included
If you wanted to include files inside the C<admin> path ending in C<.ok>,
you could just add this rule:
$ie->include('admin', qr/[.]ok$/);
$ie->evaluate(qw/admin super public records.ok/); # included
The most specific match always wins -- if there's not an exact match,
the nearest match is chosen instead.
=head1 NOTES
=over 4
=item *
t/synopsis2.t view on Meta::CPAN
$ie->exclude(qr/[.]protected$/);
is $ie->evaluate(qw/admin let me in/), 0;
is $ie->evaluate(qw/a path.protected/), 0;
is $ie->evaluate(qw/foo bar/), undef;
$ie->include(qw/foo bar/);
is $ie->evaluate(qw/foo bar/), 1;
$ie->include('admin', qr/[.]ok$/);
is $ie->evaluate(qw/admin super public records.ok/), 1;
$ie->exclude('XXX', 'YYY');
$ie->include(qr/YYY/);
is $ie->evaluate('XXX', 'YYY'), 1; # include, due to regex
( run in 0.417 second using v1.01-cache-2.11-cpan-64827b87656 )