On Sun, Feb 19, 2006 at 02:26:51PM -0800, Russ Allbery wrote:
> Yitzchak Scott-Thoennes <[EMAIL PROTECTED]> writes:
>
> > Umm, parse_from_filehandle isn't even there?
>
> Yeah, sorry, I realized that shortly after I sent my last message and have
> been poking at it. Something strange about my local testing environment
> made me think it was still there, so this was just my mistake.
>
> New release coming shortly to add the compatibility stub.
I poked at this a little more; here are some Pod::Simple changes that
fix a few differences from what Pod::Parser did: allow any kind of
object that has a getline() method, prevent output filenames beginning
&,>, from being special, preserve special STDERR handling. Also
specify INSTALLDIRS=perl in Makefile.PL when appropriate.
There remain a few Pod::Parser oddities not supported:
parse_from_file and parse_from_filehandle used to take an optional
initial hashref specifying options; the only one I actually saw code
for was {-cutting=>0} which would make the parser assume the file
starts with pod, not with perl code.
There was code to allow parse_from_file/filehandle to be recursively
called from a handler that would make the parser continue with the new
file and then switch back to the original file, but preserve the same
output file unless a new output file were specified. I can't offhand
think of any use at all for this, much less one relevant to podlators.
Pod::Parser would close the input or output file if it opened it itself
rather than being passed a handle.
--- Pod-Simple-3.04-orig/lib/Pod/Simple.pm 2006-01-16 17:49:38.000000000
-0800
+++ Pod-Simple-3.04/lib/Pod/Simple.pm 2006-02-19 17:57:13.703125000 -0800
@@ -407,13 +407,17 @@
# By here, $source is a FH.
$self->{'source_fh'} = $source;
-
+
+ # Use <$fh> instead of $fh->getline where possible (for speed)
+ my $diamondop = ref($source) =~ /^(?:GLOB|FileHandle|IO::\w+)$/
+ || eval { tied *$source };
+
my($i, @lines);
until( $self->{'source_dead'} ) {
splice @lines;
for($i = MANY_LINES; $i--;) { # read those many lines at a time
local $/ = $NL;
- push @lines, scalar(<$source>); # readline
+ push @lines, scalar($diamondop ? <$source> : $source->getline); #
readline
last unless defined $lines[-1];
# but pass thru the undef, which will set source_dead to true
}
@@ -448,11 +452,13 @@
or $to eq '-' or $to =~ m/^>&?(?:STDOUT|1)$/i
) {
$self->output_fh( *STDOUT{IO} );
+ } elsif($to =~ m/^>&?(?:STDERR|2)$/i) {
+ $self->output_fh( *STDERR{IO} );
} else {
require Symbol;
my $out_fh = Symbol::gensym();
DEBUG and print "Write-opening to $to\n";
- open($out_fh, ">$to") or Carp::croak "Can't write-open $to: $!";
+ open($out_fh, "> $to") or Carp::croak "Can't write-open $to: $!";
binmode($out_fh)
if $self->can('write_with_binmode') and $self->write_with_binmode;
$self->output_fh($out_fh);
--- Pod-Simple-3.04-orig/Makefile.PL 2004-05-24 01:21:20.000000000 -0700
+++ Pod-Simple-3.04/Makefile.PL 2006-02-19 18:08:20.687500000 -0800
@@ -15,7 +15,8 @@
NAME => 'Pod::Simple',
VERSION_FROM => 'lib/Pod/Simple.pm',
ABSTRACT_FROM => 'lib/Pod/Simple.pod',
- # INSTALLDIRS => 'perl',
+ ($] >= 5.009003 ?
+ (INSTALLDIRS => 'perl') : ()),
PREREQ_PM => {
'Text::Wrap' => '98.112902',
'Pod::Escapes' => '1.04',