Subject: | Three bugs in Pod::Usage Version 1.35 |
Date: | Wed, 27 Aug 2008 10:41:43 +0800 |
To: | <bug-Pod-Parser [...] rt.cpan.org> |
From: | David Purdie <David.Purdie [...] erggroup.com> |
Message body not shown because it is not plain text.
Distribution Name: Pod-Parser-1.35
Perl Version : v5.10.0 built for MSWin32-x86-multi-thread ( But not
relevant to these bugs)
OS : Cygwin, Solaris, Linux - bugs are OS independent
Bug 1: Use of -section in Pod::Usage does not correctly pickup head1
sections
If a =head1 section contains an =head2, then this will prevent the correct
processing of following =head1 sections
because the USAGE_HEAD2 variable is not reset
Fix: File; Usage.pm line
sub _handle_element_end {
my ($self, $element) = @_;
if ($element eq 'head1') {
$$self{USAGE_HEAD1} = $$self{PENDING}[-1][1];
$$self{USAGE_HEAD2} = undef; # FIX
Bug 2: Use of -section in Pod::Usage and =over,=back
The use of =over and =back in sections that are not selected with a
-section will cause the display of
=items in a selected section to be incorrectly located.
When -section is used then the =over operations are processed, but the
=back is ignored.
The fix also corrects the operation of elements like
=item B<This is in bold>
Fix: File: Usage.pm Sub: _handle_element_end()
Broken:
if ($$self{USAGE_SKIPPING}) {
pop @{ $$self{PENDING} };
} else {
$self->SUPER::_handle_element_end($element);
}
Fixed:
if ($$self{USAGE_SKIPPING} && $element !~ m/^over-/) {
pop @{ $$self{PENDING} };
} else {
$self->SUPER::_handle_element_end($element);
}
Bug 3: Use of -section in Pod::Usage. Can't define multiple sections
Only one RE can be passed to the Pod::Usage selector logic.
Forcing the user to use one RE doesn't allow the looping of the test
against the array of USAGE_SELECT elements.
The code works with an array - it just can't get passed in.
Fix enhance the Usage API to allow:
-sections => 'fred'
-sections => [ 'fred', 'fred/subsection' ];
Fix File; Usage.pm Function: pod2usage
elsif ($opts{"-verbose"} == 99) {
my $sections = $opts{"-sections"};
$parser->select( (ref $sections ) ? @{$sections} : $sections );
$opts{"-verbose"} = 1;
}
Files;
Examples of the three bugs
Hope all of this helps create a better module.
David Purdie
--------------------------------------------------------------------------------------------------------------
ERG Transit Systems
247 Balcatta Road Balcatta WA 6021 Australia
Website: www.erggroup.com
Tel: + 61 8 9273 1204 mailto:dpurdie@erggroup.com
The contents of this email and any attachments are confidential and may
only be read by the intended recipient
This email is confidential. If you are not the intended recipient you must
not disclose or use the information contained in it. If you have received
this email in error please notify us immediately by return email and
delete this email and any attachments. ERG is not responsible for any
changes made to this email or any attachments, other than those made by
ERG, or for the effect of the changes on the meaning of the email or any
attachments. ERG accepts no liability for any damage caused by this email
or any attachments due to viruses, interference, interception, corruption
or unauthorised access.