From: Rafael Garcia-Suarez Date: Sun, 28 Dec 2008 22:30:57 +0000 (+0100) Subject: Make Switch.pm skip POD like perl does X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=39bcdda02ea582e7bdf8b0cf2e7186e89c6baea9;p=p5sagit%2Fp5-mst-13.2.git Make Switch.pm skip POD like perl does Patch provided by Daniel Klein : It also doesn't check for invalid POD which gets ignored by the compiler anyway. Seems that Damian had a POD parser in mind when he devised those regular expressions, but perl only looks for =cut followed by a non-letter. --- diff --git a/lib/Switch.pm b/lib/Switch.pm index 4dbdeae..a12e6d6 100644 --- a/lib/Switch.pm +++ b/lib/Switch.pm @@ -72,15 +72,9 @@ sub is_block return !$ishash; } - -my $EOP = qr/\n|\Z/; -my $CUT = qr/\n=cut.*$EOP/; -my $pod_or_DATA = qr/ ^=(?:head[1-4]|item) .*? $CUT - | ^=pod .*? $CUT - | ^=for .*? $EOP - | ^=begin \s* (\S+) .*? \n=end \s* \1 .*? $EOP - | ^__(DATA|END)__\n.* - /smx; +my $pod_or_DATA = qr/ ^=[A-Za-z] .*? ^=cut (?![A-Za-z]) .*? $ + | ^__(DATA|END)__\n.* + /smx; my $casecounter = 1; sub filter_blocks