Skip Menu |

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

Report information
The Basics
Id: 16368
Status: resolved
Worked: 1 hour (60 min)
Priority: 0/
Queue: Pod-Parser

People
Owner: Nobody in particular
Requestors: steve [...] fisharerojo.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.34
Fixed in: 1.35



Subject: [PATCH] Changes to Pod::Usage to allow it to work with new and old versions of Pod::Text
The attached file allows Pod::Usage to work with the previous version of Pod::Text and the current version distributed with podlators-2.00.
--- t/pod/pod2usage2.t.old Thu Dec 8 13:10:12 2005 +++ t/pod/pod2usage2.t Thu Dec 8 13:10:39 2005 @@ -50,7 +50,7 @@ is ($exit, 2, "Exit status pod2usage ()"); ok (compare ($text, <<'EOT'), "Output test pod2usage ()"); #Usage: -# frobnicate [ -r | --recursive ] [ -f | --force ] [ -n number ] file ... +# frobnicate [ -r | --recursive ] [ -f | --force ] file ... # EOT @@ -61,7 +61,7 @@ ok (compare ($text, <<'EOT'), "Output test pod2usage (-message => '...', -verbose => 1)"); #You naughty person, what did you say? # Usage: -# frobnicate [ -r | --recursive ] [ -f | --force ] [ -n number ] file ... +# frobnicate [ -r | --recursive ] [ -f | --force ] file ... # # Options: # -r | --recursive @@ -83,7 +83,7 @@ # frobnicate - do what I mean # # SYNOPSIS -# frobnicate [ -r | --recursive ] [ -f | --force ] [ -n number ] file ... +# frobnicate [ -r | --recursive ] [ -f | --force ] file ... # # DESCRIPTION # frobnicate does foo and bar and what not. @@ -104,7 +104,7 @@ is ($exit, 0, "Exit status pod2usage (0)"); ok (compare ($text, <<'EOT'), "Output test pod2usage (0)"); #Usage: -# frobnicate [ -r | --recursive ] [ -f | --force ] [ -n number ] file ... +# frobnicate [ -r | --recursive ] [ -f | --force ] file ... # # Options: # -r | --recursive @@ -122,7 +122,7 @@ is ($exit, 42, "Exit status pod2usage (42)"); ok (compare ($text, <<'EOT'), "Output test pod2usage (42)"); #Usage: -# frobnicate [ -r | --recursive ] [ -f | --force ] [ -n number ] file ... +# frobnicate [ -r | --recursive ] [ -f | --force ] file ... # EOT @@ -130,7 +130,7 @@ is ($exit, 0, "Exit status pod2usage (-verbose => 0, -exit => 'NOEXIT')"); ok (compare ($text, <<'EOT'), "Output test pod2usage (-verbose => 0, -exit => 'NOEXIT')"); #Usage: -# frobnicate [ -r | --recursive ] [ -f | --force ] [ -n number ] file ... +# frobnicate [ -r | --recursive ] [ -f | --force ] file ... # # --NORMAL-RETURN-- EOT @@ -154,7 +154,7 @@ =head1 SYNOPSIS B<frobnicate> S<[ B<-r> | B<--recursive> ]> S<[ B<-f> | B<--force> ]> - S<[ B<-n> I<number> ]> I<file> ... + file ... =head1 DESCRIPTION @@ -172,7 +172,7 @@ Just do it! -=item B<-n> I<number> +=item B<-n> number Specify number of frobs, default is 42. --- lib/Pod/Usage.pm.old Thu Dec 8 13:08:44 2005 +++ lib/Pod/Usage.pm Thu Dec 8 13:12:45 2005 @@ -10,7 +10,7 @@ package Pod::Usage; use vars qw($VERSION); -$VERSION = 1.33; ## Current version of this package +$VERSION = "1.33_01"; ## Current version of this package require 5.005; ## requires this Perl version or later =head1 NAME @@ -96,11 +96,11 @@ "OPTIONS", "ARGUMENTS", or "OPTIONS AND ARGUMENTS" is printed. If the corresponding value is 2 or more then the entire manpage is printed. -The special verbosity level 99 requires to also specify the -section +The special verbosity level 99 requires to also specify the -sections parameter; then these sections are extracted (see L<Pod::Select>) and printed. -=item C<-section> +=item C<-sections> A string representing a selection list for sections to be printed when -verbose is set to 99, e.g. C<"NAME|SYNOPSIS|DESCRIPTION|VERSION">. @@ -531,6 +531,9 @@ '(?:\s*(?:AND|\/)\s*(?:OPTIONS|ARGUMENTS))?'; $parser->select( 'SYNOPSIS', $opt_re, "DESCRIPTION/$opt_re" ); } + elsif ($opts{"-verbose"} >= 2 && $opts{"-verbose"} != 99) { + $parser->select('.*'); + } elsif ($opts{"-verbose"} == 99) { $parser->select( $opts{"-sections"} ); $opts{"-verbose"} = 1; @@ -593,7 +596,9 @@ my ($self, $element) = @_; if ($element eq 'head1') { $$self{USAGE_HEAD1} = $$self{PENDING}[-1][1]; - $$self{PENDING}[-1][1] =~ s/^\s*SYNOPSIS\s*$/USAGE/; + if ($self->{USAGE_OPTIONS}->{-verbose} < 2) { + $$self{PENDING}[-1][1] =~ s/^\s*SYNOPSIS\s*$/USAGE/; + } } elsif ($element eq 'head2') { $$self{USAGE_HEAD2} = $$self{PENDING}[-1][1]; } @@ -610,11 +615,13 @@ # Try to do some lowercasing instead of all-caps in headings, and use # a colon to end all headings. - local $_ = $$self{PENDING}[-1][1]; - s{([A-Z])([A-Z]+)}{((length($2) > 2) ? $1 : lc($1)) . lc($2)}ge; - s/\s*$/:/ unless (/:\s*$/); - $_ .= "\n"; - $$self{PENDING}[-1][1] = $_; + if($self->{USAGE_OPTIONS}->{-verbose} < 2) { + local $_ = $$self{PENDING}[-1][1]; + s{([A-Z])([A-Z]+)}{((length($2) > 2) ? $1 : lc($1)) . lc($2)}ge; + s/\s*$/:/ unless (/:\s*$/); + $_ .= "\n"; + $$self{PENDING}[-1][1] = $_; + } } if ($$self{USAGE_SKIPPING}) { pop @{ $$self{PENDING} };
On Do. 08. Dez. 2005, 19:20:28, SMPETERS wrote: Show quoted text
> The attached file allows Pod::Usage to work with the previous version > of Pod::Text and the current version distributed with podlators-2.00.
Will be in the next release of Pod-Parser. -Marek
Fixed in 1.35