Doxygen
Perl Module Output

Since version 1.2.18, doxygen can generate a new output format we have called the "Perl Module output format". It has been designed as an intermediate format that can be used to generate new and customized output without having to modify the doxygen source. Therefore, its purpose is similar to the XML output format that can be also generated by doxygen. The XML output format is more standard, but the Perl Module output format is possibly simpler and easier to use.

The Perl Module output format is still experimental at the moment and could be changed in incompatible ways in future versions, although this should not be very probable. It is also lacking some features of other doxygen backends. However, it can be already used to generate useful output, as shown by the Perl Module-based $\mbox{\LaTeX}$ generator.

Please report any bugs or problems you find in the Perl Module backend or the Perl Module-based $\mbox{\LaTeX}$ generator to the doxygen-develop mailing list. Suggestions are welcome as well.

Usage

When the GENERATE_PERLMOD tag is enabled in the Doxyfile, running doxygen generates a number of files in the perlmod/ subdirectory of your output directory. These files are the following:

  • DoxyDocs.pm: This is the Perl module that actually contains the documentation, in the Perl Module format described below.

  • DoxyModel.pm: This Perl module describes the structure of DoxyDocs.pm, independently of the actual documentation. See below for details.

  • doxyrules.make: This file contains the make rules to build and clean the files that are generated from the Doxyfile. Also contains the paths to those files and other relevant information. This file is intended to be included by your own Makefile.

  • Makefile: This is a simple Makefile including doxyrules.make.

To make use of the documentation stored in DoxyDocs.pm you can use one of the default Perl Module-based generators provided by doxygen (at the moment this includes the Perl Module-based $\mbox{\LaTeX}$ generator, see below) or write your own customized generator. This should not be too hard if you have some knowledge of Perl and it's the main purpose of including the Perl Module backend in doxygen. See below for details on how to do this.

Using the LaTeX generator.

The Perl Module-based $\mbox{\LaTeX}$ generator is pretty experimental and incomplete at the moment, but you could find it useful nevertheless. It can generate documentation for functions, typedefs and variables within files and classes and can be customized quite a lot by redefining $\mbox{\TeX}$ macros. However, there is still no documentation on how to do this.

Setting the PERLMOD_LATEX tag to YES in the Doxyfile enables the creation of some additional files in the perlmod/ subdirectory of your output directory. These files contain the Perl scripts and $\mbox{\LaTeX}$ code necessary to generate PDF and DVI output from the Perl Module output, using pdflatex and latex respectively. Rules to automate the use of these files are also added to doxyrules.make and the Makefile.

The additional generated files are the following:

  • doxylatex.pl: This Perl script uses DoxyDocs.pm and DoxyModel.pm to generate doxydocs.tex, a $\mbox{\TeX}$ file containing the documentation in a format that can be accessed by $\mbox{\LaTeX}$ code. This file is not directly LaTeXable.

  • doxyformat.tex: This file contains the $\mbox{\LaTeX}$ code that transforms the documentation from doxydocs.tex into $\mbox{\LaTeX}$ text suitable to be $\mbox{\LaTeX}$'ed and presented to the user.

  • doxylatex-template.pl: This Perl script uses DoxyModel.pm to generate doxytemplate.tex, a $\mbox{\TeX}$ file defining default values for some macros. doxytemplate.tex is included by doxyformat.tex to avoid the need of explicitly defining some macros.

  • doxylatex.tex: This is a very simple $\mbox{\LaTeX}$ document that loads some packages and includes doxyformat.tex and doxydocs.tex. This document is $\mbox{\LaTeX}$'ed to produce the PDF and DVI documentation by the rules added to doxyrules.make.

Creation of PDF and DVI output

To try this you need to have installed latex, pdflatex and the packages used by doxylatex.tex.

  1. Update your Doxyfile to the latest version using:

    doxygen -u Doxyfile

  2. Set both GENERATE_PERLMOD and PERLMOD_LATEX tags to YES in your Doxyfile.

  3. Run doxygen on your Doxyfile:

    doxygen Doxyfile

  4. A perlmod/ subdirectory should have appeared in your output directory. Enter the perlmod/ subdirectory and run:

    make pdf

    This should generate a doxylatex.pdf with the documentation in PDF format.

  5. Run:

    make dvi

    This should generate a doxylatex.dvi with the documentation in DVI format.

Documentation format.

The Perl Module documentation generated by doxygen is stored in DoxyDocs.pm. This is a very simple Perl module that contains only two statements: an assignment to the variable $doxydocs and the customary 1; statement which usually ends Perl modules.
The documentation is stored in the variable $doxydocs, which can then be accessed by a Perl script using DoxyDocs.pm.

$doxydocs contains a tree-like structure composed of three types of nodes: strings, hashes and lists.

  • Strings: These are normal Perl strings. They can be of any length can contain any character. Their semantics depends on their location within the tree. This type of node has no children.

  • Hashes: These are references to anonymous Perl hashes. A hash can have multiple fields, each with a different key. The value of a hash field can be a string, a hash or a list, and its semantics depends on the key of the hash field and the location of the hash within the tree. The values of the hash fields are the children of the node.

  • Lists: These are references to anonymous Perl lists. A list has an undefined number of elements, which are the children of the node. Each element has the same type (string, hash or list) and the same semantics, depending on the location of the list within the tree.

As you can see, the documentation contained in $doxydocs does not present any special impediment to be processed by a simple Perl script.

Data structure

You might be interested in processing the documentation contained in DoxyDocs.pm without needing to take into account the semantics of each node of the documentation tree. For this purpose, doxygen generates a DoxyModel.pm file which contains a data structure describing the type and children of each node in the documentation tree.

The rest of this section is to be written yet, but in the meantime you can look at the Perl scripts generated by doxygen (such as doxylatex.pl or doxytemplate-latex.pl) to get an idea on how to use DoxyModel.pm.

Go to the next section or return to the index.