Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be unavailable on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 819042 - Trying to use the Pod::Man "parse_file" function in Perl results in errors
Summary: Trying to use the Pod::Man "parse_file" function in Perl results in errors
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: perl
Version: 6.2
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Petr Pisar
QA Contact: Martin Kyral
Martin Kyral
Depends On:
Blocks: 947775
TreeView+ depends on / blocked
Reported: 2012-05-04 16:30 UTC by Paul Smith
Modified: 2013-11-21 04:40 UTC (History)
4 users (show)

Fixed In Version: perl-5.10.1-133.el6
Doc Type: Bug Fix
Doc Text:
Cause: Using Pod::Man's method parse_file() without setting output handle explicitly. Consequence: The method call fails on type error instead of printing POD documentation formatted by roff to standard output. Fix: Pod::Man and Pod::Text parse_file() methods have been overloaded to use standard output handle by default. Result: Pod::Man and Pod::Text parse_file() method can be used even without setting output handle explicitly.
Clone Of:
: 826872 (view as bug list)
Last Closed: 2013-11-21 04:40:27 UTC
Target Upstream Version:

Attachments (Terms of Use)
Reproducer (115 bytes, text/plain)
2012-05-07 07:05 UTC, Petr Pisar
no flags Details
Fix from upstream (1.98 KB, patch)
2012-09-14 11:07 UTC, Petr Pisar
no flags Details | Diff
Reproducer (191 bytes, text/plain)
2013-06-06 08:35 UTC, Petr Pisar
no flags Details

System ID Private Priority Status Summary Last Updated
CPAN 77032 0 None None None Never
CPAN 77530 0 None None None Never
Red Hat Product Errata RHBA-2013:1534 0 normal SHIPPED_LIVE perl bug fix and enhancement update 2013-11-20 21:40:56 UTC

Description Paul Smith 2012-05-04 16:30:06 UTC
Description of problem:
If I try to use the Pod::Man "parse_file" function, I get failures.  Even the simplest invocation, directly from the man page, gives uninitialized value and strict refs errors.

Version-Release number of selected component (if applicable):
$ rpm -qf /usr/share/perl5/Pod/Man.pm

The documentation (man Pod::Man) says:

           use Pod::Man;
           my $parser = Pod::Man->new (release => $VERSION, section => 8);

           # Read POD from STDIN and write to STDOUT.
           $parser->parse_file (\*STDIN);
       The standard Pod::Simple method parse_file() takes one argument naming
       the POD file to read from.  By default, the output is sent to "STDOUT",
       but this can be changed with the output_fd() method.

How reproducible:

Steps to Reproduce:
Run this at a shell prompt:

$ perl -e 'use Pod::Man; my $p = Pod::Man->new(); $p->parse_file($ARGV[0]);' /usr/share/perl5/Pod/Man.pm


$ perl -e 'use Pod::Man; my $p = Pod::Man->new(); $p->parse_file(\*STDIN);' < /usr/share/perl5/Pod/Man.pm

Actual results:

$ perl -e 'use Pod::Man; my $p = Pod::Man->new(); $p->parse_file($ARGV[0]);' /usr/share/perl5/Pod/Man.pm
Can't use string ("") as a symbol ref while "strict refs" in use at /usr/share/perl5/Pod/Man.pm line 722.

Or if you add use strict:

$ perl -we 'use strict; use Pod::Man; my $p = Pod::Man->new(); $p->parse_file($ARGV[0]);' /usr/share/perl5/Pod/Man.pm
Use of uninitialized value in ref-to-glob cast at /usr/share/perl5/Pod/Man.pm line 722.
Can't use string ("") as a symbol ref while "strict refs" in use at /usr/share/perl5/Pod/Man.pm line 722.

Expected results:
I expect the output to go to STDOUT in nroff format.

Additional info:
The parse_from_file() method does appear to work correctly.

Comment 2 Petr Pisar 2012-05-07 07:05:38 UTC
Created attachment 582550 [details]

Comment 3 Petr Pisar 2012-05-07 08:28:35 UTC
This seems like a misunderstanding between Pod::Simple and Pod::Man API. (Pod::Man is subclass of Pod::Simple).

While Pod::Simple::parse_from_file() sets output to *STDOUT by default, Pod::Simple::parse_file() does not. Some other Pod::* formatters handle the output on their own.

I raised an question to Pod::Simple developers.

As a workaround, you can set the output manually by calling $p->output_fh(*STDOUT) before parse_file().

Comment 4 Petr Pisar 2012-05-31 07:40:08 UTC
Pod::Man developer decided do the fix in podlators-2.4.1 (http://cpansearch.perl.org/src/RRA/podlators-2.4.1/ChangeLog).

Comment 5 Petr Pisar 2012-09-14 11:07:19 UTC
Created attachment 612816 [details]
Fix from upstream

Comment 7 Petr Pisar 2013-06-06 08:35:54 UTC
Created attachment 757553 [details]

It's better to check Pod::Text too as it suffers from the same problem and it's changed by the patch either.

Comment 16 errata-xmlrpc 2013-11-21 04:40:27 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.