Skip Menu |

This queue is for tickets about the Pod-Parser CPAN distribution.

Report information
The Basics
Id: 14871
Status: resolved
Worked: 10 min
Priority: 0/
Queue: Pod-Parser

People
Owner: Nobody in particular
Requestors: jhoblitt [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.33
Fixed in: 1.34



Subject: Pod::Find::contains_pod() fails to match =[foo] at the top of a file
Pod::Find::contains_pod() won't match Pod markup that is not preceded by a newline (for example, the first line in a file). A patch to correct this is attached. lib/Pod/Find.pm | 2 +- t/pod/contains_pod.t | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-)
diff -urN Pod-Parser-1.33/lib/Pod/Find.pm Pod-Parser-1.33-contains_pod-fix/lib/Pod/Find.pm --- Pod-Parser-1.33/lib/Pod/Find.pm 2005-06-01 11:34:49.000000000 -1000 +++ Pod-Parser-1.33-contains_pod-fix/lib/Pod/Find.pm 2005-10-01 13:30:03.000000000 -1000 @@ -494,7 +494,7 @@ local $/ = undef; my $pod = <POD>; close(POD) || die "Error closing $file: $!\n"; - unless($pod =~ /\n=(head\d|pod|over|item)\b/s) { + unless($pod =~ /^=(head\d|pod|over|item)\b/m) { warn "No POD in $file, skipping.\n" if($verbose); return 0; diff -urN Pod-Parser-1.33/t/pod/contains_pod.t Pod-Parser-1.33-contains_pod-fix/t/pod/contains_pod.t --- Pod-Parser-1.33/t/pod/contains_pod.t 1969-12-31 14:00:00.000000000 -1000 +++ Pod-Parser-1.33-contains_pod-fix/t/pod/contains_pod.t 2005-10-01 13:32:53.000000000 -1000 @@ -0,0 +1,33 @@ +#!/usr/bin/env perl + +# Copyright (C) 2005 Joshua Hoblitt +# +# $Id$ + +use strict; +use warnings; + +use lib qw( ./lib ); + +use Test::More tests => 1; + +use Pod::Find qw( contains_pod ); +use File::Temp qw( tempdir ); + +my $valid_pod =<<END; +=head1 foo + +bar baz. + +=cut +END + +{ + my $dir = tempdir( CLEANUP => 1 ); + my $tmp_valid = File::Temp->new( DIR => $dir ); + + print $tmp_valid $valid_pod; + $tmp_valid->flush; + + ok(contains_pod($tmp_valid->filename), "contains pod"); +}
Integrated in 1.34, to be released soon. Thanks, Marek