schwern <[EMAIL PROTECTED]> writes: > I don't know if you folks caught the Pod::Tests announcement > http:[EMAIL PROTECTED]/msg00236.html > but if you'll look at the guts you'll notice it doesn't use Pod::Parser > (despite a mistaken dependency inthe Makefile.) Instead, I had to write > my own simple parser. Why? Because I gave up on figuring out > Pod::Parser. > Pod::Parser is very complete and very useful, but its massive, has a > bewildering array of methods and options and lacks useful examples. The > docs are also rather out of date (see next message). Code I looked at > which uses it (Pod::Man, Pod::Text, etc...) is equally confusing. I > invested no small amount of time trying to figure out how it works. > Unless I'm missing something, we sorely need a simple Pod parser. I > don't see anything obvious in CPAN, but I might just be missing it. > Unless anyone already knows of one, I'm going to go ahead with > Pod::Parser::Simple. I had that reaction the first time I started working with Pod::Parser too and then I figured it out and it actually made a lot of sense. I don't think it's actually that bad; you may want to give it another look. You inherit from Pod::Parser, set up private stuff in initialize(), set up per-file stuff in begin_pod(), and then everything else is done with callbacks. command() is called for any command paragraph (=whatever), verbatim() is called for any verbatim paragraph, textblock() is called for any regular paragraph, and interior_sequence() is called for every interior sequence (X<>). Print output to $self->output_handle. That's basically all there is to it. You can usually ignore much of the arguments that are passed into the callbacks. So if you were looking for something starting with =begin testing, for example, just look for that in command() and set an internal flag when you see it, just doing nothing in all the other callbacks until then. Then, if you want to look at code, that's all in verbatim paragraphs, so do all the work in verbatim(). You probably don't have to care about anything else; just replace them with stubs that don't output anything. Pod::Text is a good example of a simple use of Pod::Parser. Pod::Man is a lot more complicated for various reasons. -- Russ Allbery ([EMAIL PROTECTED]) <http://www.eyrie.org/~eagle/>
