in reply to Re: Pod::Stripper
in thread Pod::Stripper
I will now quote from perlsyn
PODs: Embedded Documentation
Perl has a mechanism for intermixing documentation with source code. While it's expecting the beginning of a new statement, if the compiler encounters a line that begins with an equal sign and a word, like this
=head1 Here There Be Pods!Then that text and all remaining text up through and including a line beginning with =cut will be ignored. The format of the intervening text is described in the perlpod manpage.
This allows you to intermix your source code and your documentation text freely, as in
=item snazzle($)The snazzle() function will behave in the most spectacular form that you can possibly imagine, not even excepting cybernetic pyrotechnics.=cut back to the compiler, nuff of this pod stuff!sub snazzle($) { my $thingie = shift; ......... }Note that pod translators should look at only paragraphs beginning with a pod directive (it makes parsing easier), whereas the compiler actually knows to look for pod escapes even in the middle of a paragraph. This means that the following secret stuff will be ignored by both the compiler and the translators.
$a=3; =secret stuff warn "Neither POD nor CODE!?" =cut back print "got $a\n";You probably shouldn't rely upon the warn() being podded out forever. Not all pod translators are well-behaved in this regard, and perhaps the compiler will become pickier.
Now I will quote from perlpod
Pod translators usually will require paragraphs to be separated by completely empty lines. If you have an apparently empty line with some spaces on it, this can cause odd formatting.Most people, and more importantly, parsers, choose to keep within the guidelines as demonstrated and explained by the pod above, and therefore so does Pod::Parser, and in turn Pod::Stripper as well.
Is there any way of dealing with such tags?
Why yes there is. I will probably be able to solve this issue by tinkering with Pod::Parser->preprocess_line and Pod::Parser->preprocess_paragraph and when I do, I will update Pod::Stripper to do a better job of stripping the pod, for all those dummies out there who can't follow guidelines. In the meantime, an immediate solution is to use Algorithm::Diff, and compare the output of Pod::Stripper and O->Deparse, as Deparse will strip "comments", but it is as smart as perl in figuring out what is actual code, and what is actual pod.
Good looking out.
| ______crazyinsomniac_____________________________ Of all the things I've lost, I miss my mind the most. perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;" |
|
|---|