Update Pod-Parser to CPAN version 1.50
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Sun, 22 Jan 2012 20:07:04 +0000 (20:07 +0000)
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Sun, 22 Jan 2012 21:44:09 +0000 (21:44 +0000)
  [DELTA]

  16-Jan-2011           Marek Rouchal                        <marekr@cpan.org>
  -----------------------------------------------------------------------------
  Version 1.50
  + fix whitespace (esp. CR [\r] related) issues with different Perl versions
    on Windows (with Perl 5.8.8 [Activestate], and 5.6.1 [SUA])
  + merge latest core (5.14.x) changes to this distro
  + CPAN#73446: fix minor POD error in InputObjects.pm
  + CPAN#43955: podchecker fails to detect superfluous =cut directive:
    implemented (and extended by a check for superfluous =pod commands) and
    documented in Pod::Checker; also added a note in the POD of all modules
    that they are part of the Pod::Parser distribution
  + CPAN#46695: use consistent version (1.50) for distribution and all Pod::
    modules in this distro (except for Pod::PlainText, which stays at 2.05)
  + CPAN#52086: mismatch between distro and module version:
    same as above
  + CPAN#55121: correction for Pod::Find and t/pod/find.t on VMS
  + CPAN#47473: podchecker on L<> url with alt text
    ... causes an error in Pod::Checker now
  + CPAN#57954: Pod::Usage does not find perldoc when perl is relocatable
    ... use $Config{scriptdirexp} instead of scriptdir
  + CPAN#61223: podchecker notice missing blank line before command
    implemented with more tests in poderrs.t and self test of all *.pms
  + CPAN#66614: parse of no final newline vs perl -w
    ... a rare case, but fixed nevertheless
  + CPAN#68157: Pod-Parser-1.38/lib/Pod/Usage.pm question/bug
    ... pass through formatting options to Pod::Text
  + CPAN#70771: mishandles symbolic links in @INC
    ... fixed by making the paths in @INC absolute, using Cwd::abs_path()
  + CPAN#71139: 3 possible optimisations
    ... applied
  + several other rt.cpan.org tickets processed and closed

17 files changed:
MANIFEST
Porting/Maintainers.pl
cpan/Pod-Parser/lib/Pod/Checker.pm
cpan/Pod-Parser/lib/Pod/Find.pm
cpan/Pod-Parser/lib/Pod/InputObjects.pm
cpan/Pod-Parser/lib/Pod/ParseUtils.pm
cpan/Pod-Parser/lib/Pod/Parser.pm
cpan/Pod-Parser/lib/Pod/PlainText.pm
cpan/Pod-Parser/lib/Pod/Select.pm
cpan/Pod-Parser/lib/Pod/Usage.pm
cpan/Pod-Parser/t/pod/empty.xr [new file with mode: 0644]
cpan/Pod-Parser/t/pod/find.t
cpan/Pod-Parser/t/pod/poderrs.t
cpan/Pod-Parser/t/pod/poderrs.xr
cpan/Pod-Parser/t/pod/selfcheck.t [new file with mode: 0644]
cpan/Pod-Parser/t/pod/testpchk.pl
pod/perldelta.pod

index 8c9651a..a7aab35 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -1967,6 +1967,7 @@ cpan/Pod-Parser/t/pod/contains_pod.t              Pod-Parser test
 cpan/Pod-Parser/t/pod/contains_pod.xr          Pod-Parser test file
 cpan/Pod-Parser/t/pod/emptycmd.t               Test empty pod directives
 cpan/Pod-Parser/t/pod/emptycmd.xr              Expected results for emptycmd.t
+cpan/Pod-Parser/t/pod/empty.xr
 cpan/Pod-Parser/t/pod/find.t                   See if Pod::Find works
 cpan/Pod-Parser/t/pod/for.t                    Test =for directive
 cpan/Pod-Parser/t/pod/for.xr                   Expected results for for.t
@@ -1996,6 +1997,7 @@ cpan/Pod-Parser/t/pod/poderrs.t                   Test POD errors
 cpan/Pod-Parser/t/pod/poderrs.xr               Expected results for poderrs.t
 cpan/Pod-Parser/t/pod/podselect.t              Test Pod::Select
 cpan/Pod-Parser/t/pod/podselect.xr             Expected results for podselect.t
+cpan/Pod-Parser/t/pod/selfcheck.t
 cpan/Pod-Parser/t/pod/special_seqs.t           Test "special" interior sequences
 cpan/Pod-Parser/t/pod/special_seqs.xr          Expected results for special_seqs.t
 cpan/Pod-Parser/t/pod/testcmp.pl               Module to compare output against expected results
index 6d554e5..5afb374 100755 (executable)
@@ -1494,11 +1494,7 @@ use File::Glob qw(:case);
 
     'Pod::Parser' => {
         'MAINTAINER' => 'marekr',
-
-        # XXX Parser.pm in the 1.38 distribution identifies itself as
-        # version 1.37!
-
-        'DISTRIBUTION' => 'MAREKR/Pod-Parser-1.38.tar.gz',
+        'DISTRIBUTION' => 'MAREKR/Pod-Parser-1.50.tar.gz',
         'FILES'        => q[cpan/Pod-Parser],
         'UPSTREAM'     => undef,
     },
index a230542..335ceee 100644 (file)
@@ -11,7 +11,7 @@ package Pod::Checker;
 use strict;
 
 use vars qw($VERSION @ISA @EXPORT %VALID_COMMANDS %VALID_SEQUENCES);
-$VERSION = '1.45';  ## Current version of this package
+$VERSION = '1.50';  ## Current version of this package
 require  5.005;    ## requires this Perl version or later
 
 use Pod::ParseUtils; ## for hyperlinks and lists
@@ -140,12 +140,28 @@ a time.
 
 There is no specification of the formatter after the C<=for> command.
 
+=item * Apparent command =foo not preceded by blank line
+
+A command which has ended up in the middle of a paragraph or other command,
+such as
+
+  =item one
+  =item two <-- bad
+
 =item * unresolved internal link I<NAME>
 
 The given link to I<NAME> does not have a matching node in the current
 POD. This also happened when a single word node name is not enclosed in
 C<"">.
 
+=item * hyperlink to URL with alt text deprecated in perlpodspec
+
+Absolute hyperlinks with alternative text like
+C<LE<lt>The Perl Home Page|http://www.perl.orgE<gt>> are discouraged in
+L<perlpodspec>. There is a section in L<perlpod> though, which allows this
+option. As L<perlpodspec> is the more modern document containing the essence
+of many prior discussions, L<Pod::Checker> flags this as an error.
+
 =item * Unknown command "I<CMD>"
 
 An invalid POD command has been found. Valid are C<=head1>, C<=head2>,
@@ -189,6 +205,14 @@ The index entry specified contains nothing but whitespace.
 
 The commands C<=pod> and C<=cut> do not take any arguments.
 
+=item * Spurious =cut command
+
+A C<=cut> command was found without a preceding POD paragraph.
+
+=item * Spurious =pod command
+
+A C<=pod> command was found after a preceding POD paragraph.
+
 =item * Spurious character(s) after =back
 
 The C<=back> command does not take any arguments.
@@ -783,6 +807,14 @@ sub end_pod {
                     -msg => "unresolved internal link '$node'"});
             }
         }
+       if($link->type() eq 'hyperlink') {
+            my $alt = $link->alttext();
+            if(defined($alt) && length($alt)) {
+                $self->poderror({ -line => $line || '', -file => $infile,
+                    -severity => 'ERROR',
+                    -msg => "hyperlink to URL with alt text deprecated in perlpodspec"});
+           }
+        }
     }
 
     # check the internal nodes for uniqueness. This pertains to
@@ -813,6 +845,8 @@ sub command {
     else { # found a valid command
         $self->{_commands}++; # delete this line if below is enabled again
 
+       $self->_commands_in_paragraphs($paragraph, $pod_para);
+
         ##### following check disabled due to strong request
         #if(!$self->{_commands}++ && $cmd !~ /^head/) {
         #    $self->poderror({ -line => $line, -file => $file,
@@ -1022,6 +1056,16 @@ sub command {
                       -severity => 'ERROR',
                       -msg => "Spurious text after =$cmd"});
             }
+           if($cmd eq 'cut' && (!$self->{_PREVIOUS} || $self->{_PREVIOUS} eq 'cut')) {
+                $self->poderror({ -line => $line, -file => $file,
+                      -severity => 'ERROR',
+                      -msg => "Spurious =cut command"});
+           }
+           if($cmd eq 'pod' && $self->{_PREVIOUS} && $self->{_PREVIOUS} ne 'cut') {
+                $self->poderror({ -line => $line, -file => $file,
+                      -severity => 'ERROR',
+                      -msg => "Spurious =pod command"});
+           }
         }
     $self->{_commands_in_head}++;
     ## Check the interior sequences in the command-text
@@ -1099,7 +1143,7 @@ sub _check_ptree {
             $text .= $self->_check_ptree($contents, $line, $file, "$nestlist$cmd");
             next;
         }
-        if($nestlist =~ /$cmd/) {
+        if(index($nestlist, $cmd) != -1) {
             $self->poderror({ -line => $line, -file => $file,
                  -severity => 'WARNING',
                  -msg => "nested commands $cmd<...$cmd<...>...>"});
@@ -1209,6 +1253,7 @@ sub verbatim {
     my ($self, $paragraph, $line_num, $pod_para) = @_;
 
     $self->_preproc_par($paragraph);
+    $self->_commands_in_paragraphs($paragraph, $pod_para);
 
     if($self->{_current_head1} eq 'NAME') {
         my ($file, $line) = $pod_para->file_line;
@@ -1224,6 +1269,7 @@ sub textblock {
     my ($file, $line) = $pod_para->file_line;
 
     $self->_preproc_par($paragraph);
+    $self->_commands_in_paragraphs($paragraph, $pod_para);
 
     # skip this paragraph if in a =begin block
     unless($self->{_have_begin}) {
@@ -1250,6 +1296,35 @@ sub _preproc_par
     }
 }
 
+# look for =foo commands at the start of a line within a paragraph, as for
+# instance the following which prints as "* one =item two".
+#
+#     =item one
+#     =item two
+#
+# Examples of =foo written in docs are expected to be indented in a verbatim
+# or marked up C<=foo> so won't be caught.  A double-angle C<< =foo >> could
+# have the =foo at the start of a line, but that should be unlikely and is
+# easily enough dealt with by not putting a newline after the C<<.
+#
+sub _commands_in_paragraphs {
+  my ($self, $str, $pod_para) = @_;
+  while ($str =~ /[^\n]\n=([a-z][a-z0-9]+)/sg) {
+    my $cmd = $1;
+    my $pos = pos($str);
+    if ($VALID_COMMANDS{$cmd}) {
+      my ($file, $line) = $pod_para->file_line;
+      my $part = substr($str, 0, $pos);
+      $line += ($part =~ tr/\n//);  # count of newlines
+
+      $self->poderror
+        ({ -line => $line, -file => $file,
+           -severity => 'ERROR',
+           -msg => "Apparent command =$cmd not preceded by blank line"});
+    }
+  }
+}
+
 1;
 
 __END__
@@ -1264,5 +1339,7 @@ Marek Rouchal E<lt>marekr@cpan.orgE<gt>
 Based on code for B<Pod::Text::pod2text()> written by
 Tom Christiansen E<lt>tchrist@mox.perl.comE<gt>
 
+B<Pod::Checker> is part of the L<Pod::Parser> distribution.
+
 =cut
 
index 8d1103b..f4f05a0 100644 (file)
@@ -14,7 +14,7 @@ package Pod::Find;
 use strict;
 
 use vars qw($VERSION);
-$VERSION = '1.35';   ## Current version of this package
+$VERSION = '1.50';   ## Current version of this package
 require  5.005;   ## requires this Perl version or later
 use Carp;
 
@@ -60,7 +60,7 @@ files/directories like RCS, CVS, SCCS, .svn are ignored.
 use Exporter;
 use File::Spec;
 use File::Find;
-use Cwd;
+use Cwd qw(abs_path cwd);
 
 use vars qw(@ISA @EXPORT_OK $VERSION);
 @ISA = qw(Exporter);
@@ -158,7 +158,13 @@ sub pod_find
             }
             push(@search, grep($_ ne File::Spec->curdir, @new_INC));
         } else {
-            push(@search, grep($_ ne File::Spec->curdir, @INC));
+            my %seen;
+            my $curdir = File::Spec->curdir;
+           foreach(@INC) {
+                next if $_ eq $curdir;
+               my $path = abs_path($_);
+                push(@search, $path) unless $seen{$path}++;
+            }
         }
 
         $opts{-perl} = 1;
@@ -198,8 +204,12 @@ sub pod_find
         # simplify path
         # on VMS canonpath will vmsify:[the.path], but File::Find::find
         # wants /unixy/paths
-        $try = File::Spec->canonpath($try) if ($^O ne 'VMS');
-        $try = VMS::Filespec::unixify($try) if ($^O eq 'VMS');
+        if ($^O eq 'VMS') {
+            $try = VMS::Filespec::unixify($try);
+        }
+        else {
+            $try = File::Spec->canonpath($try);
+        }
         my $name;
         if(-f $try) {
             if($name = _check_and_extract_name($try, $opts{-verbose})) {
@@ -208,6 +218,7 @@ sub pod_find
             next;
         }
         my $root_rx = $^O eq 'MacOS' ? qq!^\Q$try\E! : qq!^\Q$try\E/!;
+        $root_rx=~ s|//$|/|;  # remove trailing double slash
         File::Find::find( sub {
             my $item = $File::Find::name;
             if(-d) {
@@ -268,8 +279,8 @@ sub _check_and_extract_name {
     # TODO what happens on e.g. Win32?
     my $name = $file;
     if(defined $root_rx) {
-        $name =~ s/$root_rx//s;
-        $name =~ s/$SIMPLIFY_RX//s if(defined $SIMPLIFY_RX);
+        $name =~ s/$root_rx//is;
+        $name =~ s/$SIMPLIFY_RX//is if(defined $SIMPLIFY_RX);
     }
     else {
         if ($^O eq 'MacOS') {
@@ -443,6 +454,7 @@ sub pod_where {
 
       # Now concatenate this directory with the pod we are searching for
       my $fullname = File::Spec->catfile($dir, @parts);
+      $fullname = VMS::Filespec::unixify($fullname) if $^O eq 'VMS';
       warn "Filename is now $fullname\n"
         if $options{'-verbose'};
 
@@ -525,6 +537,8 @@ heavily borrowing code from Nick Ing-Simmons' PodToHtml.
 Tim Jenness E<lt>t.jenness@jach.hawaii.eduE<gt> provided
 C<pod_where> and C<contains_pod>.
 
+B<Pod::Find> is part of the L<Pod::Parser> distribution.
+
 =head1 SEE ALSO
 
 L<Pod::Parser>, L<Pod::Checker>, L<perldoc>
index 13a8618..a2dc0ce 100644 (file)
@@ -12,7 +12,7 @@ package Pod::InputObjects;
 use strict;
 
 use vars qw($VERSION);
-$VERSION = '1.31';  ## Current version of this package
+$VERSION = '1.50';  ## Current version of this package
 require  5.005;    ## requires this Perl version or later
 
 #############################################################################
@@ -39,10 +39,10 @@ This module defines some basic input objects used by B<Pod::Parser> when
 reading and parsing POD text from an input source. The following objects
 are defined:
 
-=over 4
-
 =begin __PRIVATE__
 
+=over 4
+
 =item package B<Pod::InputSource>
 
 An object corresponding to a source of POD input text. It is mostly a
@@ -50,8 +50,12 @@ wrapper around a filehandle or C<IO::Handle>-type object (or anything
 that implements the C<getline()> method) which keeps track of some
 additional information relevant to the parsing of PODs.
 
+=back
+
 =end __PRIVATE__
 
+=over 4
+
 =item package B<Pod::Paragraph>
 
 An object corresponding to a paragraph of POD input text. It may be a
@@ -923,6 +927,8 @@ sub DESTROY {
 
 =head1 SEE ALSO
 
+B<Pod::InputObjects> is part of the L<Pod::Parser> distribution.
+
 See L<Pod::Parser>, L<Pod::Select>
 
 =head1 AUTHOR
index f3c7ef4..584bc6d 100644 (file)
@@ -11,7 +11,7 @@ package Pod::ParseUtils;
 use strict;
 
 use vars qw($VERSION);
-$VERSION = '1.36'; ## Current version of this package
+$VERSION = '1.50'; ## Current version of this package
 require  5.005;    ## requires this Perl version or later
 
 =head1 NAME
@@ -845,6 +845,8 @@ Marek Rouchal E<lt>marekr@cpan.orgE<gt>, borrowing
 a lot of things from L<pod2man> and L<pod2roff> as well as other POD
 processing tools by Tom Christiansen, Brad Appleton and Russ Allbery.
 
+B<Pod::ParseUtils> is part of the L<Pod::Parser> distribution.
+
 =head1 SEE ALSO
 
 L<pod2man>, L<pod2roff>, L<Pod::Parser>, L<Pod::Checker>,
index c807f3f..d54b773 100644 (file)
@@ -12,7 +12,7 @@ use strict;
 
 ## These "variables" are used as local "glob aliases" for performance
 use vars qw($VERSION @ISA %myData %myOpts @input_stack);
-$VERSION = '1.37';  ## Current version of this package
+$VERSION = '1.50';  ## Current version of this package
 require  5.005;    ## requires this Perl version or later
 
 #############################################################################
@@ -778,11 +778,11 @@ sub parse_text {
     ## Iterate over all sequence starts text (NOTE: split with
     ## capturing parens keeps the delimiters)
     $_ = $text;
-    my @tokens = split /([A-Z]<(?:<+\s)?)/;
+    my @tokens = split /([A-Z]<(?:<+(?:\r?\n|[ \t]))?)/;
     while ( @tokens ) {
         $_ = shift @tokens;
         ## Look for the beginning of a sequence
-        if ( /^([A-Z])(<(?:<+\s)?)$/ ) {
+        if ( /^([A-Z])(<(?:<+(?:\r?\n|[ \t]))?)$/ ) {
             ## Push a new sequence onto the stack of those "in-progress"
             my $ldelim_orig;
             ($cmd, $ldelim_orig) = ($1, $2);
@@ -840,7 +840,7 @@ sub parse_text {
             $seq->append($expand_text ? &$xtext_sub($self,$_,$seq) : $_);
         }
         ## Keep track of line count
-        $line += s/\r*\n//;
+        $line += /\n/;
         ## Remember the "current" sequence
         $seq = $seq_stack[-1];
     }
@@ -963,6 +963,8 @@ sub parse_paragraph {
         $pfx = $1;
         $_ = substr($text, length $pfx);
         ($cmd, $sep, $text) = split /(\s+)/, $_, 2;
+        $sep = '' unless defined $sep;
+        $text = '' unless defined $text;
         ## If this is a "cut" directive then we dont need to do anything
         ## except return to "cutting" mode.
         if ($cmd eq 'cut') {
@@ -1016,7 +1018,8 @@ sub parse_paragraph {
     }
 
     # Update the whitespace for the next time around
-    $myData{_WHITESPACE} = $text =~ /^[^\S\r\n]+\Z/m ? 1 : 0;
+    #$myData{_WHITESPACE} = $text =~ /^[^\S\r\n]+\Z/m ? 1 : 0;
+    $myData{_WHITESPACE} = $text =~ /^[^\S\r\n]+\r*\Z/m ? 1 : 0;
 
     return  1;
 }
@@ -1096,7 +1099,7 @@ sub parse_from_filehandle {
 
         ## See if this line is blank and ends the current paragraph.
         ## If it isnt, then keep iterating until it is.
-        next unless (($textline =~ /^([^\S\r\n]*)[\r\n]*$/)
+        next unless (($textline =~ /^[^\S\r\n]*[\r\n]*$/)
                                      && (length $paragraph));
 
         ## Now process the paragraph
index 0dce179..06df184 100644 (file)
@@ -29,7 +29,7 @@ use vars qw(@ISA %ESCAPES $VERSION);
 # by Pod::Usage.
 @ISA = qw(Pod::Select);
 
-$VERSION = '2.04';
+$VERSION = '2.05';
 
 BEGIN {
    if ($] < 5.006) {
@@ -390,7 +390,7 @@ sub cmd_for {
     my $self = shift;
     local $_ = shift;
     my $line = shift;
-    return unless s/^text\b[ \t]*\n?//;
+    return unless s/^text\b[ \t]*\r?\n?//;
     $self->verbatim ($_, $line);
 }
 
@@ -485,7 +485,7 @@ sub item {
         my $margin = $$self{MARGIN};
         $$self{MARGIN} = $indent;
         my $output = $self->reformat ($tag);
-        $output =~ s/\n*$/\n/;
+        $output =~ s/[\r\n]*$/\n/;
         $self->output ($output);
         $$self{MARGIN} = $margin;
         $self->output ($self->reformat ($_)) if /\S/;
@@ -514,7 +514,7 @@ sub wrap {
     my $spaces = ' ' x $$self{MARGIN};
     my $width = $$self{width} - $$self{MARGIN};
     while (length > $width) {
-        if (s/^([^\n]{0,$width})\s+// || s/^([^\n]{$width})//) {
+        if (s/^([^\r\n]{0,$width})\s+// || s/^([^\r\n]{$width})//) {
             $output .= $spaces . $1 . "\n";
         } else {
             last;
@@ -535,8 +535,8 @@ sub reformat {
     # munging to support that.  Otherwise, smash all repeated whitespace.
     if ($$self{sentence}) {
         s/ +$//mg;
-        s/\.\n/. \n/g;
-        s/\n/ /g;
+        s/\.\r?\n/. \n/g;
+        s/[\r\n]+/ /g;
         s/   +/  /g;
     } else {
         s/\s+/ /g;
@@ -723,6 +723,8 @@ subclass of it does.  Look for L<Pod::Text::Termcap|Pod::Text::Termcap>.
 
 =head1 SEE ALSO
 
+B<Pod::PlainText> is part of the L<Pod::Parser> distribution.
+
 L<Pod::Parser|Pod::Parser>, L<Pod::Text::Termcap|Pod::Text::Termcap>,
 pod2text(1)
 
index 4724cb7..828d7bd 100644 (file)
@@ -11,7 +11,7 @@ package Pod::Select;
 use strict;
 
 use vars qw($VERSION @ISA @EXPORT $MAX_HEADING_LEVEL %myData @section_headings @selected_sections);
-$VERSION = '1.36'; ## Current version of this package
+$VERSION = '1.50'; ## Current version of this package
 require  5.005;    ## requires this Perl version or later
 
 #############################################################################
@@ -740,6 +740,8 @@ Brad Appleton E<lt>bradapp@enteract.comE<gt>
 Based on code for B<pod2text> written by
 Tom Christiansen E<lt>tchrist@mox.perl.comE<gt>
 
+B<Pod::Select> is part of the L<Pod::Parser> distribution.
+
 =cut
 
 1;
index f463fb9..8a7068a 100644 (file)
@@ -11,7 +11,7 @@ package Pod::Usage;
 use strict;
 
 use vars qw($VERSION @ISA @EXPORT);
-$VERSION = '1.36';  ## Current version of this package
+$VERSION = '1.50';  ## Current version of this package
 require  5.005;    ## requires this Perl version or later
 
 =head1 NAME
@@ -149,6 +149,14 @@ output the POD.
 
 =back
 
+=head2 Pass-through options
+
+The following options are passed through to the underlying text formatter
+(L<Pod::Text> or L<Pod::PlainText> for Perl versions E<lt> 5.005_58). See 
+the manual pages of these modules for more information.
+
+  alt code indent loose margin quotes sentence stderr utf8 width
+
 =head1 DESCRIPTION
 
 B<pod2usage> will print a usage message for the invoking script (using
@@ -434,6 +442,8 @@ with re-writing this manpage.
 
 =head1 SEE ALSO
 
+B<Pod::Usage> is part of the L<Pod::Parser> distribution.
+
 L<Pod::Parser>, L<Getopt::Long>, L<Pod::Find>
 
 =cut
@@ -564,7 +574,8 @@ sub pod2usage {
          and  $opts{'-output'} == \*STDOUT )
     {
        ## spit out the entire PODs. Might as well invoke perldoc
-       my $progpath = File::Spec->catfile($Config{scriptdir}, 'perldoc');
+       my $progpath = File::Spec->catfile($Config{scriptdirexp} 
+              || $Config{scriptdir}, 'perldoc');
        print { $opts{'-output'} } ($opts{'-message'}, "\n") if($opts{'-message'});
        if(defined $opts{-input} && $opts{-input} =~ /^\s*(\S.*?)\s*$/) {
          # the perldocs back to 5.005 should all have -F
@@ -600,7 +611,13 @@ sub new {
     if ($self->can('initialize')) {
         $self->initialize();
     } else {
-        $self = $self->SUPER::new();
+        # pass through options to Pod::Text
+        my %opts;
+               for (qw(alt code indent loose margin quotes sentence stderr utf8 width)) {
+            my $val = $params{USAGE_OPTIONS}{"-$_"};
+            $opts{$_} = $val if defined $val;
+        }
+        $self = $self->SUPER::new(%opts);
         %$self = (%$self, %params);
     }
     return $self;
diff --git a/cpan/Pod-Parser/t/pod/empty.xr b/cpan/Pod-Parser/t/pod/empty.xr
new file mode 100644 (file)
index 0000000..e69de29
index c4e8976..27d4895 100644 (file)
@@ -10,6 +10,7 @@ BEGIN {
   }
 }
 
+use strict;
 use Test::More tests => 4;
 
 BEGIN {
@@ -24,35 +25,15 @@ my $THISDIR = Cwd::cwd();
 my $VERBOSE = $ENV{PERL_CORE} ? 0 : ($ENV{TEST_VERBOSE} || 0);
 my $lib_dir = File::Spec->catdir($THISDIR,'lib');
 
-my $vms_unix_rpt = 0;
-my $vms_efs = 0;
-my $unix_mode = 1;
-
 if ($^O eq 'VMS') {
-    $lib_dir = VMS::Filespec::unixify(File::Spec->catdir($THISDIR,'-','lib','pod'));
-    $Qlib_dir = $lib_dir;
-    $Qlib_dir =~ s#\/#::#g;
-
-    $unix_mode = 0;
-    if (eval 'require VMS::Feature') {
-        $vms_unix_rpt = VMS::Feature::current("filename_unix_report");
-        $vms_efs = VMS::Feature::current("efs_charset");
-    } else {
-        my $unix_rpt = $ENV{'DECC$FILENAME_UNIX_REPORT'} || '';
-        my $efs_charset = $ENV{'DECC$EFS_CHARSET'} || '';
-        $vms_unix_rpt = $unix_rpt =~ /^[ET1]/i; 
-        $vms_efs = $efs_charset =~ /^[ET1]/i; 
-    }
-
-    # Traditional VMS mode only if VMS is not in UNIX compatible mode.
-    $unix_mode = ($vms_efs && $vms_unix_rpt);
+    $lib_dir = VMS::Filespec::unixify($lib_dir);
 }
 
 print "### 2. searching $lib_dir\n";
 my %pods = pod_find($lib_dir);
-my $result = join(',', sort values %pods);
-print "### found $result\n";
-my $compare = join(',', sort qw(
+my @results = values %pods;
+print "### found @results\n";
+my @compare = qw(
     Pod::Checker
     Pod::Find
     Pod::InputObjects
@@ -61,28 +42,15 @@ my $compare = join(',', sort qw(
     Pod::PlainText
     Pod::Select
     Pod::Usage
-));
-if ($^O eq 'VMS') {
-    $compare = lc($compare);
-    my $undollared = $Qlib_dir;
-    $undollared =~ s/\$/\\\$/g;
-    $undollared =~ s/\-/\\\-/g;
-    $result =~ s/$undollared/pod::/g;
-    $result =~ s/\$//g;
-    my $count = 0;
-    my @result = split(/,/,$result);
-    my @compare = split(/,/,$compare);
-    foreach(@compare) {
-        $count += grep {/$_/} @result;
-    }
-    is($count/($#result+1)-1,$#compare);
-}
-elsif (File::Spec->case_tolerant || $^O eq 'dos') {
-    is(lc $result,lc $compare);
-}
-else {
-    is($result,$compare);
+);
+if (File::Spec->case_tolerant || $^O eq 'dos') {
+    # must downcase before sorting
+    map {$_ = lc $_} @compare;
+    map {$_ = lc $_} @results;
 }
+my $compare = join(',', sort @compare);
+my $result = join(',', sort @results);
+is($result, $compare);
 
 print "### 3. searching for File::Find\n";
 $result = pod_where({ -inc => 1, -verbose => $VERBOSE }, 'File::Find')
@@ -90,31 +58,19 @@ $result = pod_where({ -inc => 1, -verbose => $VERBOSE }, 'File::Find')
 print "### found $result\n";
 
 require Config;
-if ($^O eq 'VMS') { # privlib is perl_root:[lib] OK but not under mms
-    if ($unix_mode) {
-        $compare = "../lib/File/Find.pm";
-    } else {
-        $compare = "lib.File]Find.pm";
-    }
-    $result =~ s/perl_root:\[\-?\.?//i;
-    $result =~ s/\[\-?\.?//i; # needed under `mms test`
-    is($result,$compare);
-}
-else {
-    $compare = $ENV{PERL_CORE} ?
+$compare = $ENV{PERL_CORE} ?
       File::Spec->catfile(File::Spec->updir, File::Spec->updir, 'lib','File','Find.pm')
       : File::Spec->catfile($Config::Config{privlibexp},"File","Find.pm");
-    my $resfile = _canon($result);
-    my $cmpfile = _canon($compare);
-    if($^O =~ /dos|win32/i && $resfile =~ /~\d(?=\\|$)/) {
-      # we have ~1 short filenames
-      $resfile = quotemeta($resfile);
-      $resfile =~ s/\\~\d(?=\\|$)/[^\\\\]+/g;
-      ok($cmpfile =~ /^$resfile$/, "pod_where found File::Find (with long filename matching)") ||
-        diag("'$cmpfile' does not match /^$resfile\$/");
-    } else {
-      is($resfile,$cmpfile,"pod_where found File::Find");
-    }
+my $resfile = _canon($result);
+my $cmpfile = _canon($compare);
+if($^O =~ /dos|win32/i && $resfile =~ /~\d(?=\\|$)/) {
+    # we have ~1 short filenames
+    $resfile = quotemeta($resfile);
+    $resfile =~ s/\\~\d(?=\\|$)/[^\\\\]+/g;
+    ok($cmpfile =~ /^$resfile$/, "pod_where found File::Find (with long filename matching)") ||
+      diag("'$cmpfile' does not match /^$resfile\$/");
+} else {
+    is($resfile,$cmpfile,"pod_where found File::Find");
 }
 
 # Search for a documentation pod rather than a module
index 98c6320..664e670 100644 (file)
@@ -118,6 +118,8 @@ L<   aha>
 L<oho   >
 L<"Warnings"> this one is ok
 L</unescaped> ok too, this POD has an X of the same name
+L<http://www.perl.org> this is OK
+L<The Perl Home Page|http://www.perl.org> this is not OK
 
 =head2 Warnings
 
@@ -192,6 +194,15 @@ we already have a head Misc
 
 =head2 another one
 
+=head2 the next line should be empty
+=head2 ... but there is a command instead
+
+And here is some text
+=head2 again followed by a command
+
+  verbatim
+=item line missing
+
 previous section is empty!
 
 =head1 LINK TESTS
@@ -206,4 +217,25 @@ trigger a podchecker warning (using bleadperl) :
 
 =cut
 
+=pod
+
+=head1 ON-OFF tests
+
+The above =pod is OK. The following =cut is ok, the one after not.
+
+=cut
+
+# some comment or code here, not POD
+
+=cut
+
+# more code
+
+=head2 This opens POD
+
+=pod
+
+And the =pod above is too much.
+
+=cut
 
index 5b40d7a..8534d9e 100644 (file)
 *** ERROR: malformed link L<> : empty link at line 116 in file t/pod/poderrs.t
 *** WARNING: ignoring leading whitespace in link at line 117 in file t/pod/poderrs.t
 *** WARNING: ignoring trailing whitespace in link at line 118 in file t/pod/poderrs.t
-*** WARNING: (section) in 'passwd(5)' deprecated at line 124 in file t/pod/poderrs.t
-*** WARNING: node '$|' contains non-escaped | or / at line 125 in file t/pod/poderrs.t
-*** WARNING: alternative text '$|' contains non-escaped | or / at line 125 in file t/pod/poderrs.t
-*** ERROR: Spurious character(s) after =back at line 131 in file t/pod/poderrs.t
-*** ERROR: Nonempty Z<> at line 145 in file t/pod/poderrs.t
-*** ERROR: Empty X<> at line 147 in file t/pod/poderrs.t
-*** WARNING: preceding non-item paragraph(s) at line 153 in file t/pod/poderrs.t
-*** WARNING: No argument for =item at line 155 in file t/pod/poderrs.t
-*** WARNING: previous =item has no contents at line 157 in file t/pod/poderrs.t
-*** WARNING: No items in =over (at line 165) / =back list at line 167 in file t/pod/poderrs.t
-*** ERROR: Spurious text after =pod at line 173 in file t/pod/poderrs.t
-*** ERROR: Spurious text after =cut at line 177 in file t/pod/poderrs.t
-*** WARNING: empty section in previous paragraph at line 193 in file t/pod/poderrs.t
+*** WARNING: (section) in 'passwd(5)' deprecated at line 126 in file t/pod/poderrs.t
+*** WARNING: node '$|' contains non-escaped | or / at line 127 in file t/pod/poderrs.t
+*** WARNING: alternative text '$|' contains non-escaped | or / at line 127 in file t/pod/poderrs.t
+*** ERROR: Spurious character(s) after =back at line 133 in file t/pod/poderrs.t
+*** ERROR: Nonempty Z<> at line 147 in file t/pod/poderrs.t
+*** ERROR: Empty X<> at line 149 in file t/pod/poderrs.t
+*** WARNING: preceding non-item paragraph(s) at line 155 in file t/pod/poderrs.t
+*** WARNING: No argument for =item at line 157 in file t/pod/poderrs.t
+*** WARNING: previous =item has no contents at line 159 in file t/pod/poderrs.t
+*** WARNING: No items in =over (at line 167) / =back list at line 169 in file t/pod/poderrs.t
+*** ERROR: Spurious text after =pod at line 175 in file t/pod/poderrs.t
+*** ERROR: Spurious text after =cut at line 179 in file t/pod/poderrs.t
+*** WARNING: empty section in previous paragraph at line 195 in file t/pod/poderrs.t
+*** ERROR: Apparent command =head2 not preceded by blank line at line 198 in file t/pod/poderrs.t
+*** WARNING: empty section in previous paragraph at line 197 in file t/pod/poderrs.t
+*** ERROR: Apparent command =head2 not preceded by blank line at line 201 in file t/pod/poderrs.t
+*** ERROR: Apparent command =item not preceded by blank line at line 204 in file t/pod/poderrs.t
+*** ERROR: Spurious =cut command at line 230 in file t/pod/poderrs.t
+*** ERROR: Spurious =pod command at line 236 in file t/pod/poderrs.t
 *** ERROR: unresolved internal link 'begin or begin' at line 108 in file t/pod/poderrs.t
 *** ERROR: unresolved internal link 'end with begin' at line 109 in file t/pod/poderrs.t
 *** ERROR: unresolved internal link 'OoPs' at line 110 in file t/pod/poderrs.t
 *** ERROR: unresolved internal link 'abc def' at line 114 in file t/pod/poderrs.t
-*** ERROR: unresolved internal link 'I/O Operators' at line 202 in file t/pod/poderrs.t
+*** ERROR: hyperlink to URL with alt text deprecated in perlpodspec at line 122 in file t/pod/poderrs.t
+*** ERROR: unresolved internal link 'I/O Operators' at line 213 in file t/pod/poderrs.t
diff --git a/cpan/Pod-Parser/t/pod/selfcheck.t b/cpan/Pod-Parser/t/pod/selfcheck.t
new file mode 100644 (file)
index 0000000..d170570
--- /dev/null
@@ -0,0 +1,45 @@
+#!/usr/bin/perl
+use File::Basename;
+use File::Spec;
+use strict;
+my $THISDIR;
+BEGIN {
+   $THISDIR = dirname $0;
+   unshift @INC, $THISDIR;
+   require "testpchk.pl";
+   import TestPodChecker qw(testpodcheck);
+}
+
+# test that our POD is correct!
+my $path = File::Spec->catfile($THISDIR,(File::Spec->updir()) x 2, 'lib', 'Pod', '*.pm');
+print "THISDIR=$THISDIR PATH=$path\n";
+my @pods = glob($path);
+print "PODS=@pods\n";
+
+print "1..",scalar(@pods),"\n";
+
+my $errs = 0;
+my $testnum = 1;
+foreach my $pod (@pods) {
+  my $out = File::Spec->catfile($THISDIR, basename($pod));
+  $out =~ s{\.pm}{.OUT};
+  my %options = ( -Out => $out );
+  my $failmsg = testpodcheck(-In => $pod, -Out => $out, -Cmp => "$THISDIR/empty.xr");
+  if($failmsg) {
+    if(open(IN, "<$out")) {
+      while(<IN>) {
+        warn "podchecker: $_";
+      }
+      close(IN);
+    } else {
+      warn "Error: Cannot read output file $out: $!\n";
+    }
+    print "not ok $testnum\n";
+    $errs++;
+  } else {
+    print "ok $testnum\n";
+  }
+  $testnum++;
+}
+exit( ($errs == 0) ? 0 : -1 )  unless $ENV{HARNESS_ACTIVE};
+
index 8aa10b9..aeb0be3 100644 (file)
@@ -23,6 +23,7 @@ use Exporter;
 
 @ISA = qw(Exporter);
 @EXPORT = qw(&testpodchecker);
+@EXPORT_OK = qw(&testpodcheck);
 $MYPKG = eval { (caller)[0] };
 
 sub stripname( $ ) {
@@ -49,7 +50,7 @@ sub testpodcheck( @ ) {
    my $cmpfile = $args{'-Cmp'} || croak "No compare-result file given!";
 
    my $different = '';
-   my $testname = basename $cmpfile, '.t', '.xr';
+   my $testname = basename $infile, '.t', '.xr';
 
    unless (-e $cmpfile) {
       my $msg = "*** Can't find comparison file $cmpfile for testing $infile";
index fd1a358..df80cfd 100644 (file)
@@ -114,7 +114,7 @@ XXX
 
 =item *
 
-L<XXX> has been upgraded from version 0.69 to version 0.70.
+L<Pod::Parser> has been upgraded from version 1.37 to version 1.50.
 
 =back