4 use warnings FATAL => 'all';
10 my ($filename, %regex) = @_;
11 open( my $fh, '<', $filename )
12 or die "couldn't open $filename for reading: $!";
16 while (my $line = <$fh>) {
17 while (my ($desc, $regex) = each %regex) {
18 if ($line =~ $regex) {
19 push @{$violated{$desc}||=[]}, $.;
25 fail("$filename contains boilerplate text");
26 diag "$_ appears on lines @{$violated{$_}}" for keys %violated;
28 pass("$filename contains no boilerplate text");
32 sub module_boilerplate_ok {
34 not_in_file_ok($module =>
35 'the great new $MODULENAME' => qr/ - The great new /,
36 'boilerplate description' => qr/Quick summary of what the module/,
37 'stub function definition' => qr/function[12]/,
42 local $TODO = "Need to replace the boilerplate text";
44 not_in_file_ok(README =>
45 "The README is used..." => qr/The README is used/,
46 "'version information here'" => qr/to provide version information/,
49 not_in_file_ok(Changes =>
50 "placeholder date/time" => qr(Date/time)
53 module_boilerplate_ok('lib/BroadWorks/OCI.pm');