| 1 | #!/usr/bin/perl -w |
| 2 | |
| 3 | # Copyright 2009, 2010, 2012, 2014 Kevin Ryde |
| 4 | |
| 5 | # This file is part of Perl-Critic-Pulp. |
| 6 | # |
| 7 | # Perl-Critic-Pulp is free software; you can redistribute it and/or |
| 8 | # modify it under the terms of the GNU General Public License as published |
| 9 | # by the Free Software Foundation; either version 3, or (at your option) any |
| 10 | # later version. |
| 11 | # |
| 12 | # Perl-Critic-Pulp is distributed in the hope that it will be useful, |
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| 15 | # Public License for more details. |
| 16 | # |
| 17 | # You should have received a copy of the GNU General Public License along |
| 18 | # with Perl-Critic-Pulp. If not, see <http://www.gnu.org/licenses/>. |
| 19 | |
| 20 | |
| 21 | # Grep for =begin not followed by newline, ie. multi-line command |
| 22 | |
| 23 | use 5.005scip-perl cpan Perl-Critic-Pulp 100 `5.005`/; |
| 24 | use strictscip-perl cpan Perl-Critic-Pulp 100 strict/; |
| 25 | use warningsscip-perl cpan Perl-Critic-Pulp 100 warnings/; |
| 26 | use Perl6::Slurpscip-perl cpan Perl-Critic-Pulp 100 Perl6/Slurp/; |
| 27 | |
| 28 | use lib::absscip-perl cpan Perl-Critic-Pulp 100 lib/abs/ '.'; |
| 29 | use MyLocatePerlscip-perl cpan Perl-Critic-Pulp 100 MyLocatePerl/; |
| 30 | use MyStuffscip-perl cpan Perl-Critic-Pulp 100 MyStuff/; |
| 31 | |
| 32 | my $verbose = 0; |
| 33 | |
| 34 | my $l = MyLocatePerl->newscip-perl cpan Perl-Critic-Pulp 100 MyLocatePerl/new(). (exclude_t => 1, |
| 35 | include_pod => 1); |
| 36 | while (my ($filename, $str) = $l->nextscip-perl cpan Perl-Critic-Pulp 100 MyLocatePerl/next().) { |
| 37 | if ($verbose) { printscip-perl cpan Perl-Critic-Pulp 100 main/print(). "look at $filename\n"; } |
| 38 | $str =~ tr/\r//d; # new CRs |
| 39 | |
| 40 | while ($str =~ /(^|\n)(=begin[^\n]*\n[^\n]+)/sg) { |
| 41 | my $pos = $-scip-perl cpan Perl-Critic-Pulp 100 main/`@-`.[0]; |
| 42 | my $lines = $2scip-perl cpan Perl-Critic-Pulp 100 main/$2.; |
| 43 | my $lastchar = ordscip-perl cpan Perl-Critic-Pulp 100 main/ord().(substrscip-perl cpan Perl-Critic-Pulp 100 main/substr().($lines,-1,1)); |
| 44 | |
| 45 | my ($line, $col) = MyStuff::pos_to_line_and_columnscip-perl cpan Perl-Critic-Pulp 100 MyStuff/pos_to_line_and_column(). ($str, $pos); |
| 46 | printscip-perl cpan Perl-Critic-Pulp 100 main/print(). "$filename:$line:$col: char=$lastchar\n$lines\n"; |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | exitscip-perl cpan Perl-Critic-Pulp 100 main/exit(). 0; |
| 51 | |
| 52 | =pod |
| 53 | |
| 54 | =begin comment |
| 55 | blah |
| 56 | |
| 57 | =end comment |
| 58 | |
| 59 | =cut |