POD is much -- much -- easier to learn than HTML. Frankly, there really isn't any learning involved. If you know HTML, you can learn POD in 30 seconds. Ready? Here we go:
- =pod
- Marks the start of the POD
- =head1 Some Text for a Level 1 Heading
- Like an H1 tag
- =head2 Some Text for a Level 2 Heading
- Like an H2 tag
- =over 4
- Starts a list
- =item Some text
- Like a LI tag
- =back
- Ends the list
- =cut
- Marks the end of the POD
- other text that starts in column 1
- Like a P tag, this will word-wrap into a paragraph.
- other text that is indented
- Like a PRE tag, this will be displayed unaltered.
That's pretty much it, really. You just need to remember to follow each of the above with a blank line and you're set.
There are also things to mark text as being B<bold>, or a F<filename>, or a L<link> to another module's documentation, but beyond that there isn't much to a POD. There is a semi-standard format for what to include in your documentation (what the various section headings are), but that would be equally true regardless of whether you were writing your docs in POD or HTML.
Wally Hartshorn
| [reply] |
Yeah, except that none of your examples would work. You have to put blank lines before and after each POD directive. Having an =item with a label, but no text, confuses most processors.
There are a lot of dark corners in POD. I am constantly reminding people when to indent, and when not to. I think POD violates a lot of the DWIM'ness of perl, because a lot of times POD does something really weird. Especially if you forget to put new lines in or something like that.
Today one of my co-workers put a blank space on a line after some pod directive. Well, that doesn't work, but it is not clear why (unless you are using cperl-mode, and have those annoying underscores showing up all over your code). Hey, this isn't Python; whitespace shouldn't matter! :)
That said, I always use POD, because that's all there is. pod2usage is great, too. But I wish we had something like JavaDoc, which is SO much easier to use, and it generates better output, too. Java has a head start as a strongly typed language, of course. But why can't we have =sub, =param, and =return tokens in POD?
-Mike
| [reply] |
Yeah, except that none of your examples would work. You have to put blank lines before and after each POD directive.
Which is why I noted "You just need to remember to follow each of the above with a blank line and you're set." Although what I wrote looks like an example, it wasn't intended to be. It's just a list (specifically, an HTML definition list). :-) Oh well.
Wally Hartshorn
| [reply] |
Even with that method, why not write your documentation in POD and then use Pod2Html to make up your documentation repository? Now your documentation and code is in one file, perl guys will appreciate finding POD, Minor code changes mean minor doc revs that can happen much easier.
You can also create a webpage that will dynamically create the HTML from POD and server that up.
<!--#exec cmd="pod2html $ARGSCRIPT /tmp/podoutput.htm" -->
<!--#include file="/tmp/podoutput.htm" -->
Remember, if you do it more than once, let the computer do it for you every time but the first.
Hammy | [reply] [d/l] |