This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix to Pod::Usage to work with all recent Pod::Text versions. Also
authorSteve Peters <steve@fisharerojo.org>
Thu, 8 Dec 2005 15:53:36 +0000 (15:53 +0000)
committerSteve Peters <steve@fisharerojo.org>
Thu, 8 Dec 2005 15:53:36 +0000 (15:53 +0000)
includes a change to the Pod::Usage test file for compatibility
purposes.

p4raw-id: //depot/perl@26303

lib/Pod/Usage.pm
lib/Pod/t/Usage.t

index a29eab2..eee915e 100644 (file)
@@ -531,6 +531,9 @@ sub pod2usage {
                      '(?:\s*(?:AND|\/)\s*(?:OPTIONS|ARGUMENTS))?';
         $parser->select( 'SYNOPSIS', $opt_re, "DESCRIPTION/$opt_re" );
     }
+    elsif ($opts{"-verbose"} == 2) {
+        $parser->select('.*');
+    }
     elsif ($opts{"-verbose"} == 99) {
         $parser->select( $opts{"-sections"} );
         $opts{"-verbose"} = 1;
@@ -591,7 +594,7 @@ sub seq_i { return $_[1] }
 # Note that the below is very, very specific to Pod::Text.
 sub _handle_element_end {
     my ($self, $element) = @_;
-    if ($element eq 'head1') {
+    if ($element eq 'head1' && $self->{USAGE_OPTIONS}->{-verbose} < 2) {
         $$self{USAGE_HEAD1} = $$self{PENDING}[-1][1];
         $$self{PENDING}[-1][1] =~ s/^\s*SYNOPSIS\s*$/USAGE/;
     } elsif ($element eq 'head2') {
@@ -610,11 +613,13 @@ sub _handle_element_end {
 
         # 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} };
index 343a0a7..2cabb55 100644 (file)
@@ -36,7 +36,7 @@ SKIP: {
         pod2usage({ -verbose => 0, -exit => 'noexit', 
                     -output => \*FAKEOUT, -input => $file });
     };
-    like( $@, qr/^Can't open $file:/, 
+    like( $@, qr/^Can't open $file/, 
           'File not found without -pathlist' );
 
     eval {