From: Gurusamy Sarathy Date: Wed, 5 May 1999 07:29:43 +0000 (+0000) Subject: upgrade Pod::Parser to v1.081 from CPAN X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e9fdc7d2ad34e80787f760dcc04e2f23a1599092;p=p5sagit%2Fp5-mst-13.2.git upgrade Pod::Parser to v1.081 from CPAN p4raw-id: //depot/perl@3304 --- diff --git a/lib/Pod/Checker.pm b/lib/Pod/Checker.pm index 1eaab71..6607ad9 100644 --- a/lib/Pod/Checker.pm +++ b/lib/Pod/Checker.pm @@ -13,7 +13,7 @@ package Pod::Checker; use vars qw($VERSION); -$VERSION = 1.08; ## Current version of this package +$VERSION = 1.081; ## Current version of this package require 5.004; ## requires this Perl version or later =head1 NAME diff --git a/lib/Pod/InputObjects.pm b/lib/Pod/InputObjects.pm index 9bbc6cf..007fd74 100644 --- a/lib/Pod/InputObjects.pm +++ b/lib/Pod/InputObjects.pm @@ -11,7 +11,7 @@ package Pod::InputObjects; use vars qw($VERSION); -$VERSION = 1.08; ## Current version of this package +$VERSION = 1.081; ## Current version of this package require 5.004; ## requires this Perl version or later ############################################################################# @@ -496,7 +496,7 @@ sub _set_child2parent_links { my ($self, @children) = @_; ## Make sure any sequences know who their parent is for (@children) { - next unless ref $_; + next unless ref; if ($_->isa('Pod::InteriorSequence') or $_->can('nested')) { $_->nested($self); } @@ -510,7 +510,7 @@ sub _unset_child2parent_links { $self->{'-parent_sequence'} = undef; my $ptree = $self->{'-ptree'}; for (@$ptree) { - next unless ($_ and ref $_ and $_->isa('Pod::InteriorSequence')); + next unless (length and ref and $_->isa('Pod::InteriorSequence')); $_->_unset_child2parent_links(); } } @@ -801,7 +801,7 @@ sub prepend { my $self = shift; local *ptree = $self; for (@_) { - next unless $_; + next unless length; if (@ptree and !(ref $ptree[0]) and !(ref $_)) { $ptree[0] = $_ . $ptree[0]; } @@ -827,7 +827,7 @@ sub append { my $self = shift; local *ptree = $self; for (@_) { - next unless $_; + next unless length; if (@ptree and !(ref $ptree[-1]) and !(ref $_)) { $ptree[-1] .= $_; } @@ -863,7 +863,7 @@ sub _unset_child2parent_links { my $self = shift; local *ptree = $self; for (@ptree) { - next unless ($_ and ref $_ and $_->isa('Pod::InteriorSequence')); + next unless (length and ref and $_->isa('Pod::InteriorSequence')); $_->_unset_child2parent_links(); } } diff --git a/lib/Pod/Parser.pm b/lib/Pod/Parser.pm index b81b080..9bc771d 100644 --- a/lib/Pod/Parser.pm +++ b/lib/Pod/Parser.pm @@ -13,7 +13,7 @@ package Pod::Parser; use vars qw($VERSION); -$VERSION = 1.08; ## Current version of this package +$VERSION = 1.081; ## Current version of this package require 5.004; ## requires this Perl version or later ############################################################################# @@ -654,6 +654,7 @@ is a reference to the parse-tree object. ## an interior sequence looks like '-' or '=', but not '--' or '==' use vars qw( $ARROW_RE ); $ARROW_RE = join('', qw{ (?: [^=]+= | [^-]+- )$ }); +#$ARROW_RE = qr/(?:[^=]+=|[^-]+-)$/; ## 5.005+ only! sub parse_text { my $self = shift; @@ -672,7 +673,7 @@ sub parse_text { ## Convert method calls into closures, for our convenience my $xseq_sub = $expand_seq; my $xptree_sub = $expand_ptree; - if ($expand_seq eq 'interior_sequence') { + if (defined $expand_seq and $expand_seq eq 'interior_sequence') { ## If 'interior_sequence' is the method to use, we have to pass ## more than just the sequence object, we also need to pass the ## sequence name and text. @@ -705,7 +706,7 @@ sub parse_text { ++$line if ($_ eq "\n"); ## Look for the beginning of a sequence if ( /^([A-Z])(<)$/ ) { - ## Push a new sequence onto the stack on of those "in-progress" + ## Push a new sequence onto the stack of those "in-progress" $seq = Pod::InteriorSequence->new( -name => ($cmd = $1), -ldelim => $2, -rdelim => '', @@ -729,7 +730,7 @@ sub parse_text { } else { ## In the middle of a sequence, append this text to it - $seq->append($_) if $_; + $seq->append($_) if length; } ## Remember the "current" sequence and the previously seen token ($seq, $prev) = ( $seq_stack[-1], $_ ); diff --git a/lib/Pod/PlainText.pm b/lib/Pod/PlainText.pm index e629fc8..3816bad 100644 --- a/lib/Pod/PlainText.pm +++ b/lib/Pod/PlainText.pm @@ -13,7 +13,7 @@ package Pod::PlainText; use vars qw($VERSION); -$VERSION = 1.08; ## Current version of this package +$VERSION = 1.081; ## Current version of this package require 5.004; ## requires this Perl version or later =head1 NAME @@ -279,7 +279,7 @@ sub fill { $line .= $_; } } - $par .= "$line\n" if $line; + $par .= "$line\n" if length $line; $par .= "\n"; return $par; } diff --git a/lib/Pod/Select.pm b/lib/Pod/Select.pm index 96377d4..26cbe02 100644 --- a/lib/Pod/Select.pm +++ b/lib/Pod/Select.pm @@ -13,7 +13,7 @@ package Pod::Select; use vars qw($VERSION); -$VERSION = 1.08; ## Current version of this package +$VERSION = 1.081; ## Current version of this package require 5.004; ## requires this Perl version or later ############################################################################# diff --git a/lib/Pod/Usage.pm b/lib/Pod/Usage.pm index 855dbf0..9cb71e0 100644 --- a/lib/Pod/Usage.pm +++ b/lib/Pod/Usage.pm @@ -13,7 +13,7 @@ package Pod::Usage; use vars qw($VERSION); -$VERSION = 1.08; ## Current version of this package +$VERSION = 1.081; ## Current version of this package require 5.004; ## requires this Perl version or later =head1 NAME @@ -389,7 +389,7 @@ sub pod2usage { ## User passed a ref to a hash %opts = %{$_} if (ref($_) eq 'HASH'); } - elsif (/^[-+]?\d+$/o) { + elsif (/^[-+]?\d+$/) { ## User passed in the exit value to use $opts{"-exitval"} = $_; } @@ -488,13 +488,13 @@ sub preprocess_paragraph { local $_ = shift; my $line = shift; ## See if this is a heading and we arent printing the entire manpage. - if (($self->{USAGE_OPTIONS}->{-verbose} < 2) && /^=head/o) { + if (($self->{USAGE_OPTIONS}->{-verbose} < 2) && /^=head/) { ## Change the title of the SYNOPSIS section to USAGE - s/^=head1\s+SYNOPSIS\s*$/=head1 USAGE/o; + s/^=head1\s+SYNOPSIS\s*$/=head1 USAGE/; ## Try to do some lowercasing instead of all-caps in headings s{([A-Z])([A-Z]+)}{((length($2) > 2) ? $1 : lc($1)) . lc($2)}ge; ## Use a colon to end all headings - s/\s*$/:/o unless (/:\s*$/o); + s/\s*$/:/ unless (/:\s*$/); $_ .= "\n"; } return $self->SUPER::preprocess_paragraph($_); diff --git a/t/pod/special_seqs.t b/t/pod/special_seqs.t index 5352fd1..1b31387 100755 --- a/t/pod/special_seqs.t +++ b/t/pod/special_seqs.t @@ -27,4 +27,6 @@ too: C<$self-Emethod()> and C<$self-E{FIELDNAME}> and C<{FOO=EBAR}>. Dont forget C<$self-Emethod()-E{FIELDNAME} = {FOO=EBAR}>. +And make sure that C<0> works too! + =cut diff --git a/t/pod/special_seqs.xr b/t/pod/special_seqs.xr index b6ae7fd..6795de0 100644 --- a/t/pod/special_seqs.xr +++ b/t/pod/special_seqs.xr @@ -11,3 +11,5 @@ Dont forget `$self->method()->{FIELDNAME} = {FOO=>BAR}'. + And make sure that `0' works too! + diff --git a/t/pod/testp2pt.pl b/t/pod/testp2pt.pl index 140de05..9df5b9f 100644 --- a/t/pod/testp2pt.pl +++ b/t/pod/testp2pt.pl @@ -3,8 +3,9 @@ package TestPodIncPlainText; BEGIN { use File::Basename; use File::Spec; + use Cwd qw(abs_path); push @INC, '..'; - my $THISDIR = dirname $0; + my $THISDIR = abs_path(dirname $0); unshift @INC, $THISDIR; require "testcmp.pl"; import TestCompare; @@ -19,6 +20,7 @@ use vars qw(@ISA @EXPORT $MYPKG); use Carp; use Exporter; #use File::Compare; +#use Cwd qw(abs_path); @ISA = qw(Pod::PlainText); @EXPORT = qw(&testpodplaintext); @@ -30,6 +32,16 @@ $MYPKG = eval { (caller)[0] }; sub catfile(@) { File::Spec->catfile(@_); } +my $INSTDIR = abs_path(dirname $0); +$INSTDIR = (dirname $INSTDIR) if (basename($INSTDIR) eq 'xtra'); +$INSTDIR = (dirname $INSTDIR) if (basename($INSTDIR) eq 'pod'); +$INSTDIR = (dirname $INSTDIR) if (basename($INSTDIR) eq 't'); +my @PODINCDIRS = ( catfile($INSTDIR, 'lib', 'Pod'), + catfile($INSTDIR, 'scripts'), + catfile($INSTDIR, 't', 'pod'), + catfile($INSTDIR, 't', 'pod', 'xtra') + ); + ## Find the path to the file to =include sub findinclude { my $self = shift; @@ -42,19 +54,8 @@ sub findinclude { ## 1. the directory containing this pod file my $thispoddir = dirname $self->input_file; ## 2. the parent directory of the above - my $parentdir = ($thispoddir eq '.') ? '..' : dirname $thispoddir; - ## 3. any Pod/ or scripts/ subdirectory of these two - my @dirs = (); - for ($thispoddir, $parentdir) { - my $dir = $_; - for ( qw(scripts lib) ) { - push @dirs, $dir, catfile($dir, $_), - catfile($dir, 'Pod'), - catfile($dir, $_, 'Pod'); - } - } - my %dirs = (map { ($_ => 1) } @dirs); - my @podincdirs = (sort keys %dirs); + my $parentdir = dirname $thispoddir; + my @podincdirs = ($thispoddir, $parentdir, @PODINCDIRS); for (@podincdirs) { my $incfile = catfile($_, $incname);