6 use Test::More tests => 5;
9 my ($filename, %regex) = @_;
10 open( my $fh, '<', $filename )
11 or die "couldn't open $filename for reading: $!";
15 while (my $line = <$fh>) {
16 while (my ($desc, $regex) = each %regex) {
17 if ($line =~ $regex) {
18 push @{$violated{$desc}||=[]}, $.;
24 fail("$filename contains boilerplate text");
25 diag "$_ appears on lines @{$violated{$_}}" for keys %violated;
27 pass("$filename contains no boilerplate text");
31 sub module_boilerplate_ok {
33 not_in_file_ok($module =>
34 'the great new $MODULENAME' => qr/ - The great new /,
35 'boilerplate description' => qr/Quick summary of what the module/,
36 'stub function definition' => qr/function[12]/,
40 not_in_file_ok(README =>
41 "The README is used..." => qr/The README is used/,
42 "'version information here'" => qr/to provide version information/,
45 not_in_file_ok(Changes =>
46 "placeholder date/time" => qr(Date/time)
49 module_boilerplate_ok('lib/Bit/MorseSignals.pm');
50 module_boilerplate_ok('lib/Bit/MorseSignals/Emitter.pm');
51 module_boilerplate_ok('lib/Bit/MorseSignals/Receiver.pm');