Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • We have a test in the test suite at Dev/perl.t that runs perl -c and tests POD on everything.

    #!/usr/bin/perl -w

    use warnings;
    use strict;

    use Test::More;
    use Test::Pod;
    use File::Next;
    use App::Ack;

    use FindBin;

    my $startpath = $ENV{TTROOT} || '.';

    my $iter =
        File::Next::files( {
            descend_filter  => sub { $_ ne '.svn' && $_ ne 'tmp' },
        }, $startpath );

    my @files;

    while ( my $file = $iter->() ) {
        my @types = App::Ack::filetypes( $file );
        push( @files, $file ) if grep { $_ eq 'perl' || $_ eq 'pod' } @types;
    }

    die 'No Perl files found!' unless @files;

    plan( tests => 2 * @files );

    my $lib = "$FindBin::Bin/../Lib";

    for my $filename ( @files ) {
        open( my $fh, '<', $filename ) or die "Can't read $filename: $!";
        my $header = <$fh>;
        close $header;

        my $taint = $header && ( $header =~ /perl.+-T/ ) ? '-T' : '';
        my $output = qx( perl $taint -c -I$lib $filename 2>&1 );
        like( $output, qr/syntax OK/, "$filename passes perl -c" );

        pod_file_ok( $filename );
    }

    --

    --
    xoa

    • We have a virtually identical test. Takes four minutes to run. Hence the above snippet :)