);
my $Test = Test::Builder->new;
-my $updir = File::Spec->updir();
+
+my $no_plan;
sub import {
my $self = shift;
*{$caller.'::all_perl_files_ok'} = \&all_perl_files_ok;
}
$Test->exported_to($caller);
+
+ if ($_[0] && $_[0] eq 'no_plan') {
+ shift;
+ $no_plan = 1;
+ }
$Test->plan(@_);
}
sub _all_perl_files {
my @all_files = _all_files(@_);
- return grep { _is_perl_module($_) || _is_perl_script($_) } @all_files;
+ return grep { _is_perl_module($_) || _is_perl_script($_) || _is_pod_file($_) } @all_files;
}
sub _all_files {
sub _debug_line {
my ( $options, $line ) = @_;
$line->[2] =~ s/\n\z//g;
- return "line $line->[1]: $line->[0] " . (
+ return "line $line->[1]: $line->[0]" . (
$options->{show_lines} ? qq{: } . _show_whitespace( $line->[2] ) : q{}
);
}
$_[0] =~ /\.pm$/i || $_[0] =~ /::/;
}
+sub _is_pod_file {
+ $_[0] =~ /\.pod$/i;
+}
+
sub _is_perl_script {
my $file = shift;
return 1 if $file =~ /\.pl$/i;
}
sub _make_plan {
+ return if $no_plan;
unless ($Test->has_plan) {
$Test->plan( 'no_plan' );
}
use Test::EOL;
all_perl_files_ok({ trailing_whitespace => 1 }, @mydirs );
+or
+
+ use Test::More;
+ use Test::EOL 'no_test';
+ all_perl_files_ok();
+ done_testing;
+
=head1 DESCRIPTION
This module scans your project/distribution for any perl files (scripts,
all_perl_files_ok( [ \%options ], [ @directories ] )
Applies C<eol_unix_ok()> to all perl files found in C<@directories> (and sub
-directories). If no <@directories> is given, the starting point is one level
-above the current running script, that should cover all the files of a typical
-CPAN distribution. A perl file is *.pl or *.pm or *.t or a file starting
+directories). If no <@directories> is given, the starting point is the current
+working directory, as tests are usually run from the top directory in a typical
+CPAN distribution. A perl file is *.pl or *.pm or *.pod or *.t or a file starting
with C<#!...perl>
Valid C<\%options> currently are: