Skip Menu |

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

Report information
The Basics
Id: 21010
Status: resolved
Priority: 0/
Queue: Pod-Parser

People
Owner: Marek.Rouchal [...] gmx.net
Requestors: cpan [...] clotho.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.34
Fixed in: 1.35



Subject: Calling parse_from_file twice causes errors
The following code exposes a Pod::Parser crash: use Pod::Parser; use IO::String; use Carp; $SIG{__DIE__} = \&Carp::confess; { my $pod_string = ''; my $handle = IO::String->new( \$pod_string ); my $parser = Pod::Parser->new(); $parser->parse_from_file( $0, $handle ); } { my $parser = Pod::Parser->new(); $parser->parse_from_file( $0, '/dev/null' ); } The result on Perl 5.8.6 on MacOSX 10.4 is: % perl foo.pl Can't locate object method "OPEN" via package "IO::String" at /Users/chris/perl/System/Library/Perl/5.8.6/Pod/Parser.pm line 1239. at /Users/chris/perl/System/Library/Perl/5.8.6/Pod/Parser.pm line 1239 Pod::Parser::parse_from_file('Pod::Parser=HASH(0x18015a8)', 'foo.pl', '/dev/null') called at foo.pl line 16 So, it appears that the IO::String instance is being cached erroneously across calls to parse_from_file. This error occurs in the real world when running Devel::Cover on Perl::Critic::Violation. The latter uses an IO::String with Pod::PlainText to extract it's own diagnostics from POD while the former uses Pod::Parser via Pod::Coverage to count the number of subroutines which have POD. I've worked around the problem by using parse_from_filehandle instead of parse_from_file in Perl::Critic::Violation.
This is a very strange thing indeed - it is the my ($in_fh,$out_fh) = ... if(...); that does not seem to localize the vars if the condition is false! I split the my declaration and the if-clause and then it works. Will be in the next Pod::Parser. Cheers, Marek
fixed in 1.35