1 package BSE::MessageScanner;
5 our $VERSION = "1.001";
7 =item BSE::MessageScanner->scan(\@basepaths)
9 Scan .tmpl, .pm and .pl files under the given directories for apparent
10 message uses and return each use with the id, file and line number.
12 This isn't perfect and attempts to skip generated message ids.
16 my $base_re = qr(\b(msg:[\w-]+(?:/\$?[\w-]+)*));
19 my ($class, $bases) = @_;
25 -f && /\.(tmpl|pm|pl)$/ && push @files, $File::Find::name;
30 for my $file (@files) {
31 open my $fh, "<", $file
32 or die "Cannot open $file: $!\n";
34 while (my $line = <$fh>) {
35 next if $line =~ /NOMSGID/;
36 my @msgs = $line =~ m($base_re);
38 $line =~ / _ / && $file =~ /\.tmpl$/
40 push @ids, map [ $_, $file, $. ], grep !/\$/, @msgs;