From: Steve Peters Date: Thu, 8 Dec 2005 15:53:36 +0000 (+0000) Subject: Fix to Pod::Usage to work with all recent Pod::Text versions. Also X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7eb7d786de9bebe120f2143ce65237684a3a5d80;p=p5sagit%2Fp5-mst-13.2.git Fix to Pod::Usage to work with all recent Pod::Text versions. Also includes a change to the Pod::Usage test file for compatibility purposes. p4raw-id: //depot/perl@26303 --- diff --git a/lib/Pod/Usage.pm b/lib/Pod/Usage.pm index a29eab2..eee915e 100644 --- a/lib/Pod/Usage.pm +++ b/lib/Pod/Usage.pm @@ -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} }; diff --git a/lib/Pod/t/Usage.t b/lib/Pod/t/Usage.t index 343a0a7..2cabb55 100644 --- a/lib/Pod/t/Usage.t +++ b/lib/Pod/t/Usage.t @@ -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 {