X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FModule%2FMetadata.pm;fp=lib%2FModule%2FMetadata.pm;h=0d73988489dc122afb84125a8775e2bb0b8d1a89;hb=cfedad8991041ad6c33a056b5208151178f27372;hp=e5910d09a065202a8fa368cf58fe7d6a2b3bb774;hpb=a4aafbc2cda96948f9a5dd4475d0f78f27d29afe;p=p5sagit%2FModule-Metadata.git diff --git a/lib/Module/Metadata.pm b/lib/Module/Metadata.pm index e5910d0..0d73988 100644 --- a/lib/Module/Metadata.pm +++ b/lib/Module/Metadata.pm @@ -61,10 +61,6 @@ my $VERS_REGEXP = qr{ # match a VERSION definition =[^=~] # = but not ==, nor =~ }x; -my $PODSECT_REGEXP = qr{ - ^=(cut|pod|head[1-4]|over|item|back|begin|end|for|encoding)\b -}x; - sub new_from_file { my $class = shift; my $filename = File::Spec->rel2abs( shift ); @@ -500,9 +496,14 @@ sub _parse_fh { chomp( $line ); + # From toke.c : any line that begins by "=X", where X is an alphabetic + # character, introduces a POD segment. my $is_cut; - if ( $line =~ /$PODSECT_REGEXP/o ) { - $is_cut = $1 eq 'cut'; + if ( $line =~ /^=([a-zA-Z].*)/ ) { + my $cmd = $1; + # Then it goes back to Perl code for "=cutX" where X is a non-alphabetic + # character (which includes the newline, but here we chomped it away). + $is_cut = $cmd =~ /^cut(?:[^a-zA-Z]|$)/; $in_pod = !$is_cut; }