From: Steve Peters Date: Wed, 1 Mar 2006 16:53:49 +0000 (+0000) Subject: Upgrade to podlators-2.04 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fcf69717c2de827296693b4af999fb68ae2904d7;p=p5sagit%2Fp5-mst-13.2.git Upgrade to podlators-2.04 p4raw-id: //depot/perl@27357 --- diff --git a/MANIFEST b/MANIFEST index 0eeaae0..194f1c6 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2213,6 +2213,7 @@ lib/Pod/Text/Color.pm Convert POD data to color ASCII text lib/Pod/Text/Overstrike.pm Convert POD data to formatted overstrike text lib/Pod/Text.pm Pod-Parser - convert POD data to formatted ASCII text lib/Pod/Text/Termcap.pm Convert POD data to ASCII text with format escapes +lib/Pod/t/filehandle.t podlators test lib/Pod/t/Functions.t See if Pod::Functions works lib/Pod/t/htmlescp.pod pod2html escape test input data lib/Pod/t/htmlescp.t pod2html escape test diff --git a/lib/Pod/Man.pm b/lib/Pod/Man.pm index e4cf0be..dd81035 100644 --- a/lib/Pod/Man.pm +++ b/lib/Pod/Man.pm @@ -1,5 +1,5 @@ # Pod::Man -- Convert POD data to formatted *roff input. -# $Id: Man.pm,v 2.8 2006-01-25 23:56:52 eagle Exp $ +# $Id: Man.pm,v 2.9 2006-02-19 23:02:35 eagle Exp $ # # Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 # Russ Allbery @@ -40,7 +40,7 @@ use POSIX qw(strftime); # Don't use the CVS revision as the version, since this module is also in Perl # core and too many things could munge CVS magic revision strings. This # number should ideally be the same as the CVS revision in podlators, however. -$VERSION = 2.08; +$VERSION = 2.09; # Set the debugging level. If someone has inserted a debug function into this # class already, use that. Otherwise, use any Pod::Simple debug function @@ -819,11 +819,18 @@ sub devise_title { # Determine the modification date and return that, properly formatted in ISO # format. If we can't get the modification date of the input, instead use the -# current time. +# current time. Pod::Simple returns a completely unuseful stringified file +# handle as the source_filename for input from a file handle, so we have to +# deal with that as well. sub devise_date { my ($self) = @_; my $input = $self->source_filename; - my $time = ($input ? (stat $input)[9] : time); + my $time; + if ($input) { + $time = (stat $input)[9] || time; + } else { + $time = time; + } return strftime ('%Y-%m-%d', localtime $time); } @@ -1220,6 +1227,14 @@ sub parse_from_file { return $retval; } +# Pod::Simple failed to provide this backward compatibility function, so +# implement it ourselves. File handles are one of the inputs that +# parse_from_file supports. +sub parse_from_filehandle { + my $self = shift; + $self->parse_from_file (@_); +} + ############################################################################## # Translation tables ############################################################################## diff --git a/lib/Pod/Text.pm b/lib/Pod/Text.pm index 089d6b0..a23f70a 100644 --- a/lib/Pod/Text.pm +++ b/lib/Pod/Text.pm @@ -1,5 +1,5 @@ # Pod::Text -- Convert POD data to formatted ASCII text. -# $Id: Text.pm,v 3.6 2006-01-25 23:56:52 eagle Exp $ +# $Id: Text.pm,v 3.7 2006-02-19 23:02:35 eagle Exp $ # # Copyright 1999, 2000, 2001, 2002, 2004, 2006 # by Russ Allbery @@ -41,7 +41,7 @@ use Pod::Simple (); # Don't use the CVS revision as the version, since this module is also in Perl # core and too many things could munge CVS magic revision strings. This # number should ideally be the same as the CVS revision in podlators, however. -$VERSION = 3.06; +$VERSION = 3.07; ############################################################################## # Initialization @@ -600,6 +600,14 @@ sub parse_from_file { return $retval; } +# Pod::Simple failed to provide this backward compatibility function, so +# implement it ourselves. File handles are one of the inputs that +# parse_from_file supports. +sub parse_from_filehandle { + my $self = shift; + $self->parse_from_file (@_); +} + ############################################################################## # Module return value and documentation ############################################################################## diff --git a/lib/Pod/t/filehandle.t b/lib/Pod/t/filehandle.t new file mode 100644 index 0000000..bcad199 --- /dev/null +++ b/lib/Pod/t/filehandle.t @@ -0,0 +1,122 @@ +#!/usr/bin/perl -w +# $Id: filehandle.t,v 1.1 2006-02-19 23:02:37 eagle Exp $ +# +# filehandle.t -- Test the parse_from_filehandle interface. +# +# Copyright 2006 by Russ Allbery +# +# This program is free software; you may redistribute it and/or modify it +# under the same terms as Perl itself. + +BEGIN { + chdir 't' if -d 't'; + if ($ENV{PERL_CORE}) { + @INC = '../lib'; + } else { + unshift (@INC, '../blib/lib'); + } + unshift (@INC, '../blib/lib'); + $| = 1; + print "1..3\n"; +} + +END { + print "not ok 1\n" unless $loaded; +} + +use Pod::Man; +use Pod::Text; + +$loaded = 1; +print "ok 1\n"; + +my $man = Pod::Man->new or die "Cannot create parser\n"; +my $text = Pod::Text->new or die "Cannot create parser\n"; +my $n = 2; +while () { + next until $_ eq "###\n"; + open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n"; + while () { + last if $_ eq "###\n"; + print TMP $_; + } + close TMP; + open (IN, '< tmp.pod') or die "Cannot open tmp.pod: $!\n"; + open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n"; + $man->parse_from_filehandle (\*IN, \*OUT); + close IN; + close OUT; + open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n"; + while () { last if /^\.TH/ } + my $output; + { + local $/; + $output = ; + } + close OUT; + my $expected = ''; + while () { + last if $_ eq "###\n"; + $expected .= $_; + } + if ($output eq $expected) { + print "ok $n\n"; + } else { + print "not ok $n\n"; + print "Expected\n========\n$expected\nOutput\n======\n$output\n"; + } + $n++; + open (IN, '< tmp.pod') or die "Cannot open tmp.pod: $!\n"; + open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n"; + $text->parse_from_filehandle (\*IN, \*OUT); + close IN; + close OUT; + open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n"; + { + local $/; + $output = ; + } + close OUT; + unlink ('tmp.pod', 'out.tmp'); + $expected = ''; + while () { + last if $_ eq "###\n"; + $expected .= $_; + } + if ($output eq $expected) { + print "ok $n\n"; + } else { + print "not ok $n\n"; + print "Expected\n========\n$expected\nOutput\n======\n$output\n"; + } + $n++; +} + +# Below the marker are bits of POD, corresponding expected nroff output, and +# corresponding expected text output. The input and output are separated by +# lines containing only ###. + +__DATA__ + +### +=head1 NAME + +gcc - GNU project C and C++ compiler + +=head1 C++ NOTES + +Other mentions of C++. +### +.SH "NAME" +gcc \- GNU project C and C++ compiler +.SH "\*(C+ NOTES" +.IX Header " NOTES" +Other mentions of \*(C+. +### +NAME + gcc - GNU project C and C++ compiler + +C++ NOTES + Other mentions of C++. + +###