Subject: | Pod::Find::contains_pod() fails to detect Pod if opening tag is misspelled |
contains_pod() fails to detect pod if someone uses invalid, block
opening command paragraphs.
for example, this is not detected as pod:
=head
something
=cut
So I just added =cut to the contains_pod() regex, I think this is not a
permanent solution as someone could misspell cut as well.
lib/Pod/Find.pm | 2 +-
t/pod/contains_bad_pod.xr |only
t/pod/contains_pod.t | 6 +++++-
3 files changed, 6 insertions(+), 2 deletions(-)
Subject: | contains_pod.patch |
diff -urN Pod-Parser-1.35/lib/Pod/Find.pm Pod-Parser-1.35.new/lib/Pod/Find.pm
--- Pod-Parser-1.35/lib/Pod/Find.pm 2005-10-04 11:40:15.000000000 -0700
+++ Pod-Parser-1.35.new/lib/Pod/Find.pm 2007-10-16 11:51:34.000000000 -0700
@@ -494,7 +494,7 @@
local $/ = undef;
my $pod = <POD>;
close(POD) || die "Error closing $file: $!\n";
- unless($pod =~ /^=(head\d|pod|over|item)\b/m) {
+ unless($pod =~ /^=(head\d|pod|over|item|cut)\b/m) {
warn "No POD in $file, skipping.\n"
if($verbose);
return 0;
diff -urN Pod-Parser-1.35/t/pod/contains_bad_pod.xr Pod-Parser-1.35.new/t/pod/contains_bad_pod.xr
--- Pod-Parser-1.35/t/pod/contains_bad_pod.xr 1969-12-31 16:00:00.000000000 -0800
+++ Pod-Parser-1.35.new/t/pod/contains_bad_pod.xr 2007-10-16 11:49:41.000000000 -0700
@@ -0,0 +1,5 @@
+=head foo
+
+bar baz.
+
+=cut
diff -urN Pod-Parser-1.35/t/pod/contains_pod.t Pod-Parser-1.35.new/t/pod/contains_pod.t
--- Pod-Parser-1.35/t/pod/contains_pod.t 2005-10-04 11:38:58.000000000 -0700
+++ Pod-Parser-1.35.new/t/pod/contains_pod.t 2007-10-16 11:50:53.000000000 -0700
@@ -7,10 +7,14 @@
use strict;
use lib qw( ./lib );
-use Test::More tests => 1;
+use Test::More tests => 2;
use Pod::Find qw( contains_pod );
{
ok(contains_pod('t/pod/contains_pod.xr'), "contains pod");
}
+
+{
+ ok(contains_pod('t/pod/contains_bad_pod.xr'), "contains bad pod");
+}