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
# 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 <rra@stanford.edu>
# 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
# 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);
}
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
##############################################################################
# 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 <rra@stanford.edu>
# 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
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
##############################################################################
--- /dev/null
+#!/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 <rra@stanford.edu>
+#
+# 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 (<DATA>) {
+ next until $_ eq "###\n";
+ open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
+ while (<DATA>) {
+ 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 (<OUT>) { last if /^\.TH/ }
+ my $output;
+ {
+ local $/;
+ $output = <OUT>;
+ }
+ close OUT;
+ my $expected = '';
+ while (<DATA>) {
+ 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 = <OUT>;
+ }
+ close OUT;
+ unlink ('tmp.pod', 'out.tmp');
+ $expected = '';
+ while (<DATA>) {
+ 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++.
+
+###