On Wed, Dec 07, 2005 at 07:48:57PM -0800, Russ Allbery wrote:
> Steve Peters <[EMAIL PROTECTED]> writes:
>
> > Actually, I spoke too soon. The changes to Pod::Text have broken
> > Pod::Usage. It depends on the existing previous functionality of
> > Pod::Text when it was a subclass of Pod::Select. Somewhere, the
> > functionality of the select() method is broken between Pod::Text,
> > Pod::Simple, and Pod::Simple::BlackBox.
>
> I submitted a patch that fixed this and passed all the tests a while
> back. Do you know if you're missing that patch completely, or if it's
> just not working?
>
The patch is in Pod::Usage now, but it didn't take things quite far enough.
Attached is the final differences between Pod::Usage and its tests in
bleadperl and the current Pod::Parser 1.33 in the Pod-Parser distribution.
This has been tested with the new podlators and the previous version to
make sure that the hierarchy differences do not cause problems in
testing. That means the changes to Pod::Usage should be able to go to
maint without requiring Pod::Simple and Pod::Escapes and the updated
podlators distribution.
Steve Peters
[EMAIL PROTECTED]
--- 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} };