From: Vincent Pit Date: Mon, 30 Jul 2012 15:36:16 +0000 (+0200) Subject: Don't skip lines beginning by # in POD X-Git-Tag: release_1.0.10_001~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FModule-Metadata.git;a=commitdiff_plain;h=81ce8c826e1a168a78e7ab6be41ecddd3df38199 Don't skip lines beginning by # in POD They are only comments in code. --- diff --git a/lib/Module/Metadata.pm b/lib/Module/Metadata.pm index d0b470d..8af7984 100644 --- a/lib/Module/Metadata.pm +++ b/lib/Module/Metadata.pm @@ -496,7 +496,6 @@ sub _parse_fh { my $line_num = $.; chomp( $line ); - next if $line =~ /^\s*#/; my $is_cut; if ( $line =~ /^=(.{0,3})/ ) { @@ -532,6 +531,9 @@ sub _parse_fh { } else { + # Skip comments in code + next if $line =~ /^\s*#/; + # parse $line to see if it's a $VERSION declaration my( $vers_sig, $vers_fullname, $vers_pkg ) = ($line =~ /VERSION/) diff --git a/t/metadata.t b/t/metadata.t index 4a64b54..942cc62 100644 --- a/t/metadata.t +++ b/t/metadata.t @@ -429,6 +429,9 @@ Simple - It's easy. Simple Simon +You can find me on the IRC channel +#simon on irc.perl.org. + =cut --- $dist->regen; @@ -478,8 +481,21 @@ $pm_info = Module::Metadata->new_from_module( } $pod{$section} = $content; } - is( $pod{NAME}, q|Simple - It's easy.|, 'collected NAME pod section' ); - is( $pod{AUTHOR}, q|Simple Simon|, 'collected AUTHOR pod section' ); + my %expected = ( + NAME => q|Simple - It's easy.|, + AUTHOR => <<'EXPECTED' +Simple Simon + +You can find me on the IRC channel +#simon on irc.perl.org. +EXPECTED + ); + for my $text (values %expected) { + $text =~ s/^\s+//; + $text =~ s/\s+$//; + } + is( $pod{NAME}, $expected{NAME}, 'collected NAME pod section' ); + is( $pod{AUTHOR}, $expected{AUTHOR}, 'collected AUTHOR pod section' ); } {