summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSteve Peters <steve@fisharerojo.org>2005-12-08 15:53:36 +0000
committerSteve Peters <steve@fisharerojo.org>2005-12-08 15:53:36 +0000
commit7eb7d786de9bebe120f2143ce65237684a3a5d80 (patch)
tree9954938fe04d33d07867df54405f6322db22cfd1 /lib
parentd4c83939befe2c4e6ec23a304312d9e2abca3b1d (diff)
downloadperl-7eb7d786de9bebe120f2143ce65237684a3a5d80.tar.gz
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
Diffstat (limited to 'lib')
-rw-r--r--lib/Pod/Usage.pm17
-rw-r--r--lib/Pod/t/Usage.t2
2 files changed, 12 insertions, 7 deletions
diff --git a/lib/Pod/Usage.pm b/lib/Pod/Usage.pm
index a29eab2ba9..eee915e1d4 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 343a0a73dd..2cabb55aca 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 {