Re: How do I get Pod::Simple to extract pod from its containing file?
On Tue, Jan 29, 2013 at 11:52:43AM -0700, Karl Williamson wrote: On 01/26/2013 08:37 PM, Karl Williamson wrote: 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. 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? So no one thinks there is a trivial way to get this extraction. Would someone make a suggestion as to the easiest way to do so using modules that will continue to ship with the Perl 5 core (unlike Pod::Parser)? No-one answered this, did they? Is it possible to extract the pod by subclassing Pod::Simple, and the subclass being a null parser that prints out the Pod that it was given? Nicholas Clark
Re: How do I get Pod::Simple to extract pod from its containing file?
On 03/06/2013 06:15 AM, Nicholas Clark wrote: On Tue, Jan 29, 2013 at 11:52:43AM -0700, Karl Williamson wrote: On 01/26/2013 08:37 PM, Karl Williamson wrote: 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. 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? So no one thinks there is a trivial way to get this extraction. Would someone make a suggestion as to the easiest way to do so using modules that will continue to ship with the Perl 5 core (unlike Pod::Parser)? No-one answered this, did they? No Is it possible to extract the pod by subclassing Pod::Simple, and the subclass being a null parser that prints out the Pod that it was given? Nicholas Clark Yes, but I was hoping there was something that is less work, or already done, or done for some other purpose, such as Pod::Checker, and I can re-use the relevant parts.
Re: How do I get Pod::Simple to extract pod from its containing file?
On 01/26/2013 08:37 PM, Karl Williamson wrote: 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? So no one thinks there is a trivial way to get this extraction. Would someone make a suggestion as to the easiest way to do so using modules that will continue to ship with the Perl 5 core (unlike Pod::Parser)?
Re: How do I get Pod::Simple to extract pod from its containing file?
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?
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?
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?