From: Vincent Pit Date: Mon, 30 Jul 2012 22:48:58 +0000 (+0200) Subject: Test for __(?:DATA|END)__ in the "code" section of the loop X-Git-Tag: release_1.0.10_001~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b48c592a53eb11a94aed21e26a5654bcda996bf3;p=p5sagit%2FModule-Metadata.git Test for __(?:DATA|END)__ in the "code" section of the loop If the line is =cut, then it can't possibly be __DATA__ or __END__. --- diff --git a/lib/Module/Metadata.pm b/lib/Module/Metadata.pm index 0d73988..72c6ffa 100644 --- a/lib/Module/Metadata.pm +++ b/lib/Module/Metadata.pm @@ -507,9 +507,6 @@ sub _parse_fh { $in_pod = !$is_cut; } - # Would be nice if we could also check $in_string or something too - last if !$in_pod && $line =~ /^__(?:DATA|END)__$/; - if ( $in_pod ) { if ( $line =~ /^=head[1-4]\s+(.+)\s*$/ ) { @@ -538,6 +535,9 @@ sub _parse_fh { # Skip comments in code next if $line =~ /^\s*#/; + # Would be nice if we could also check $in_string or something too + last if $line =~ /^__(?:DATA|END)__$/; + # parse $line to see if it's a $VERSION declaration my( $vers_sig, $vers_fullname, $vers_pkg ) = ($line =~ /VERSION/)