Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Documentation

by jonjacobmoon (Pilgrim)
on Sep 26, 2002 at 22:50 UTC ( [id://201081]=perlquestion: print w/replies, xml ) Need Help??

jonjacobmoon has asked for the wisdom of the Perl Monks concerning the following question:

I am curious what everyone uses or how people document their code. Specifically, is there a system (outside of PerlDoc) or an application that anyone might recommend for extracting documentation from comments or code? Someone recommended RoboDoc to me, but I was wondering if there were others people liked or disliked.


I admit it, I am Paco.

Replies are listed 'Best First'.
Re: Documentation
by seattlejohn (Deacon) on Sep 26, 2002 at 23:28 UTC
    Well, I use POD/perldoc. I find it very appealing for the following reasons:
    • It's integral to the code (if I want it to be), so I'm less likely to forgot to update doc when I change the code.
    • POD can be exposed at run-time using modules like Pod::Usage -- so with just a little bit of planning, the documentation can double as help/manpage info for your users.
    • POD doesn't require any extra tools, which is nice if you're developing on and deploying to multiple systems.
    • It's easy to convert POD to plain text, HTML, and a variety of other output flavors.
    • Various Pod::* modules give me other ways to manipulate the POD contents. For example, I can write a pre-deployment check that makes sure my POD contains correct copyright notices and so on.

    Of course, if there's something better out there I'd love to know about it too. But looking at the doc for RoboDoc -- I haven't actually used it -- makes it seem like it offers POD-like functionality but not a lot of extras that would compel me to switch.

Re: Documentation
by hiseldl (Priest) on Sep 26, 2002 at 23:49 UTC
    DocBook and Emacs. Both are aquired tastes, but once you get used to them, they're very flexible and powerful tools.

    (Vim would work too :)

    --
    hiseldl
    What time is it? It's Camel Time!

      Are you looking for the benefits of Pod and Docbook at the same time? Then you might want to look at CPAN for Pod::Docbook as well...

      --
      Cheers, Joe

        Excellent. I'll try that out! I'll definitely keep this module on my watch list.

        Thanks!

        --
        hiseldl
        What time is it? It's Camel Time!

Re: Documentation
by weini (Friar) on Sep 27, 2002 at 06:55 UTC
Re: Documentation
by hsmyers (Canon) on Sep 27, 2002 at 12:59 UTC

    Mostly I use pod plus Pod::usage. I like noweb and various other literate approaches as well--just depends on the circumstances. But always at least pod...

    --hsm

    "Never try to teach a pig to sing...it wastes your time and it annoys the pig."
Re: Documentation
by spartan (Pilgrim) on Sep 27, 2002 at 13:58 UTC
    Being a relative newbie to perl (I've been coding different projects in perl for about a year and a half now), I don't make use of POD. I know, bad boy. I prefer to write plain old html (in vi), and put it on a box here all the admins use as a documentation repository. I suppose it all depends on what level of knowledge you currently have, and what you will feel comfortable using.
    I know that I fall into this category. When I learn how to use POD (that should be soon too) I'll go back and integrate all of my html docs into the scripts themselves as suggested earlier.
    YMMV


    Very funny Scotty... Now PLEASE beam down my PANTS!

      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

        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

      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

Re: Documentation
by Flexx (Pilgrim) on Sep 29, 2002 at 16:20 UTC

    Hi jonjacobmoon!

    I just wanted to let you know about this node, where I have written about the tools I use for code documentation and to produce whitepaper/technical reports. It might be interesting to you, or other readers of this thread.

    So long,
    Flexx

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://201081]
Approved by ybiC
Front-paged by wil
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-04-22 23:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found