Author: paultcochrane
Date: Mon Jan 8 10:46:02 2007
New Revision: 16495
Modified:
trunk/ (props changed)
trunk/lib/Parrot/Distribution.pm
Log:
[lib] Added a new method is_perl_exemption() to exclude any files which are
automatically generated, or are included as part of Parrot but sourced from
elsewhere. Now using this as part of get_perl_language_files(). This
should reduce the size of the coding standards hammer a bit (see RT#40905).
Modified: trunk/lib/Parrot/Distribution.pm
==============================================================================
--- trunk/lib/Parrot/Distribution.pm (original)
+++ trunk/lib/Parrot/Distribution.pm Mon Jan 8 10:46:02 2007
@@ -525,6 +525,7 @@
my $manifest = ExtUtils::Manifest::maniread('MANIFEST');
foreach my $file ( keys(%$manifest) ) {
+ next if $self->is_perl_exemption($file);
next unless $self->is_perl($file);
push @files, $file;
}
@@ -532,6 +533,39 @@
return @files;
}
+=item C<is_perl_exemption()>
+
+Determines if the given filename is an exemption to being in the Perl
+source. This is to exclude automatically generated Perl-language files, and
+any external modules Parrot might have.
+
+=cut
+
+sub is_perl_exemption {
+ my $self = shift;
+ my $file = shift;
+
+ my @exemptions = qw(
+ languages/lua/Lua/parser.pm
+ languages/regex/lib/Regex/Grammar.pm
+ lib/Class/*
+ lib/Digest/*
+ lib/File/*
+ lib/Parse/*
+ lib/Pod/*
+ lib/SmartLink.pm
+ lib/Test/*
+ lib/Text/*
+ );
+
+ # XXX this is inefficient isn't it?
+ foreach my $exemption ( @exemptions ) {
+ return 1 if $file =~ $exemption;
+ }
+
+ return 0;
+}
+
=item C<is_perl()>
Determines if the given filename is Perl source