Skip Menu |

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

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

People
Owner: Marek.Rouchal [...] gmx.net
Requestors: PETAMEM [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.35
Fixed in: 1.36



Subject: Pod::Usage -output $FH will not update when called multiple times
Following situation: * perlscript.pl uses Module.pm, both contain POD and use POD::Usage * in perlscript.pl we have a function "help" which calls pod2usage({... -output => IO::Scalar->new{\$FH1) ... }); and subsequently "Module::help" * in Module.pm we have a function "help" which calls pod2usage({... -output => IO::Scalar->new{\$FH2) ... }); * pod2usage in Module.pm ignores the filehandle and uses always $FH1 => We get two times the content of the perlscript.pl POD and Module.pm POD is ignored.
Subject: actually the problem persists even without -output
On Tue Apr 29 10:29:52 2008, PETAMEM wrote: Show quoted text
> Following situation: > > * perlscript.pl uses Module.pm, both contain POD and use POD::Usage > > * in perlscript.pl we have a function "help" which calls pod2usage({... > -output => IO::Scalar->new{\$FH1) ... }); and subsequently "Module::help" > > * in Module.pm we have a function "help" which calls pod2usage({... > -output => IO::Scalar->new{\$FH2) ... }); > > * pod2usage in Module.pm ignores the filehandle and uses always $FH1 > > => We get two times the content of the perlscript.pl POD and Module.pm > POD is ignored.
tested to call pod2usage within Module.pm directly (print to STDOUT). This also prints the content that was gathered in perlscript.pl
This is working as designed - see this section from Pod::Usage: -input A reference to a filehandle, or the pathname of a file from which the invoking script's pod documentation should be read. It defaults to the file indicated by $0 ($PROGRAM_NAME for users of English.pm). So you are reading twice the same file (perlscript.pl). pod2usage() does NOT look at the caller() or anything else. However, I took this RT to add this to the Pod::Usage documentation: #If you are calling B<pod2usage()> from a module and want to display #that module's POD, you can use this: # # use Pod::Find qw(pod_where); # pod2usage( -input => pod_where({-inc => 1}, __PACKAGE__) ); I hope this answers your call. The change will be available in Pod-Parser-1.36. -Marek