don't die just because an invalid file, skip and continue
Signed-off-by: Caleb Cushing <xenoterracide@gmail.com>
Caleb Cushing
12 years ago
1 | 1 | use 5.008; |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | BEGIN { | |
5 | # VERSION | |
6 | } | |
4 | ||
5 | # VERSION | |
6 | ||
7 | 7 | use Moose; |
8 | 8 | with ( |
9 | 9 | 'Dist::Zilla::Role::FileMunger', |
35 | 35 | my $content = $file->content; |
36 | 36 | |
37 | 37 | my $doc = PPI::Document->new(\$content) |
38 | or croak( 'Error parsing "' | |
38 | or $self->log( 'Skipping: "' | |
39 | 39 | . $file->name |
40 | . '" with PPI: ' | |
40 | . '" error with PPI: ' | |
41 | 41 | . PPI::Document->errstr |
42 | 42 | ) |
43 | 43 | ; |
44 | ||
45 | return unless defined $doc; | |
44 | 46 | |
45 | 47 | my $comments = $doc->find('PPI::Token::Comment'); |
46 | 48 |