Re: How do I get Pod::Simple to extract pod from its containing file?

[email protected] (Karl Williamson) Sat, 26 Jan 2013 19:36:13 -0700
Newsgroups perl.pod-people
Message-ID <[email protected]>
On 01/26/2013 02:23 PM, Russ Allbery wrote:
> Karl Williamson <[email protected]> writes:
>
>> With Pod::Parser, you just do
>> 	parse_from_file($in_fh, $out_fh)
>
>> and it outputs the pod to $out_fh.  Pod::Simple has a method of the same
>> name which is supposed to emulate the Pod::Parser method, but when I run
>> it, nothing is output.
>
> Did you flush $out_fh?  Pod::Parser did that but Pod::Simple doesn't, so
> it's possible if you're doing something short that the entire output was
> still buffered.
>
> Pod::Man and Pod::Text use this Pod::Simple method and do have test suites
> for it and it seems to work.
>

See the attached program.  The resultant file is 0 length.
simple.pl (application/x-perl, 200 B)
use strict;
use warnings;

open my $in_fh, '<:bytes', 'pod/perlre.pod' or die "$!";
use Pod::Simple;
my $parser = Pod::Simple->new();
$parser->parse_from_file($in_fh, "/tmp/parse.out");
close $in_fh;