perldocumentation-generation

Does Perl have something like Java/PHP Docs?


Does Perl have a Perl Docs generator? Something like Java Docs or PHP Documenter?


Solution

  • Yes, it's called POD (formerly: perldoc)

    You simply write documentation in the source, just like with javadoc.

    Briefly, "=item" is a bulleted item, e.g. a function or a parameter "=over" goes down a level of identation, "=back" goes up a level. Use "=cut" where you want to switch back to perl code.

    Here is an example of what it could look like:

    =item $b->add_module ( %options )
    
    Initialize a module. A module is a repository or a branch of a repository.
    Valid options are
    
    =over
    
    =item id
    
    Id of this module
    
    =item repo
    
    Url of repository. Currently only subversion repositories are supported.
    
    =back
    
    =cut
    sub add_module($%)
    {
    

    Simply pass your perl code through the perldoc program to get the formatted documentation.