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

2013-01-26 Thread Karl Williamson

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.


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

2013-01-26 Thread David E. Wheeler
On Jan 26, 2013, at 8:49 AM, Karl Williamson pub...@khwilliamson.com wrote:

 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.

Code looks okay. I don't see a test case, though. Care to add one?

David



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

2013-01-26 Thread Karl Williamson

On 01/26/2013 02:23 PM, Russ Allbery wrote:

Karl Williamson pub...@khwilliamson.com 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
Description: Perl program


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

2013-01-26 Thread Karl Williamson

On 01/26/2013 07:44 PM, Russ Allbery wrote:

Karl Williamson pub...@khwilliamson.com writes:

On 01/26/2013 02:23 PM, Russ Allbery wrote:

Karl Williamson pub...@khwilliamson.com 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.


Oh!  I misunderstood, sorry.  parse_from_file() does indeed invoke the
parser with the appropriate actions, but what you meant was that
Pod::Parser's null parser, when not subclassed, just printed the POD
back out again, so you could use it as a way to extract the POD from a
file.  I believe Pod::Simple's null parser does nothing at all, so you
get an empty file.

Yes.  I think that's an incompatibility.



If I turn on DEBUGing, it's doing a lot.  Is there some trivial way to 
extract the pod?