summaryrefslogtreecommitdiff
path: root/doc/perlmod.doc
blob: 8616dc648db0beefd36bb1ed9e7d0346f2e83931 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
/*! \page perlmod Perl Module Output

\addindex perlmod

<p>Since version 1.2.18, Doxygen can generate a new output format we 
have called the &quot;Perl Module output format&quot;.  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.

<p>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 \LaTeX generator.

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

\section using_perlmod_fmt Usage

<p>When the \ref cfg_generate_perlmod "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:

<ul>

<li>`DoxyDocs.pm`:  This is the Perl module that actually
contains the documentation, in the Perl Module format described 
\ref doxydocs_format "below".

<li>`DoxyModel.pm`:  This Perl module describes the structure of
`DoxyDocs.pm`, independently of the actual documentation.  See 
\ref doxymodel_format "below" for details.

<li>`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.

<li>`Makefile`:  This is a simple Makefile including 
`doxyrules.make`.

</ul>

<p>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 \LaTeX generator,
see \ref perlmod_latex "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 \ref doxydocs_format "below" for details on how
to do this.

<-- want to use \LaTeX but not possible in headings -->
\section perlmod_latex Using the LaTeX generator.

<p>The Perl Module-based \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 \TeX macros.  However, there is still no documentation on
how to do this.

<p>Setting the \ref cfg_perlmod_latex "PERLMOD_LATEX" tag to \c YES in the 
\c Doxyfile enables the creation of some additional files in the `perlmod/` 
subdirectory of your output directory.  These files contain the Perl 
scripts and \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`.

<p>The additional generated files are the following:

<ul>

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

<li>`doxyformat.tex`: This file contains the \LaTeX code that 
transforms the documentation from doxydocs.tex into \LaTeX text 
suitable to be \LaTeX'ed and presented to the user.

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

<li>`doxylatex.tex`:  This is a very simple \LaTeX document that 
loads some packages and includes doxyformat.tex and doxydocs.tex. This 
document is \LaTeX'ed to produce the PDF and DVI documentation by the 
rules added to `doxyrules.make`.

</ul>

\subsection pm_pdf_gen Creation of PDF and DVI output 

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

<ol>

<li>Update your `Doxyfile` to the latest version using:

<pre>doxygen -u Doxyfile</pre>

<li>Set both \ref cfg_generate_perlmod "GENERATE_PERLMOD" and 
\ref cfg_perlmod_latex "PERLMOD_LATEX" tags to 
\c YES in your Doxyfile.

<li>Run Doxygen on your Doxyfile:

<pre>doxygen Doxyfile</pre>

<li>A `perlmod/` subdirectory should have appeared in your output 
directory.  Enter the `perlmod/` subdirectory and run:

<pre>make pdf</pre>

<p>This should generate a `doxylatex.pdf` with the documentation 
in PDF format.

<li>Run:

<pre>make dvi</pre>

<p>This should generate a `doxylatex.dvi` with the documentation 
in DVI format.

</ol>

\section doxydocs_format Documentation format.

<p>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`.

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

<ul>

<li>`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.

<li>`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.

<li>`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.

</ul>

<p>As you can see, the documentation contained in `$doxydocs`
does not present any special impediment to be processed by a simple
Perl script.  
<!--
To be able to generate meaningful output using the
documentation contained in `$doxydocs` you'll probably need to
know the semantics of the nodes of the documentation tree, which we
present in \ref perlmod_tree "this page".
-->

\section doxymodel_format Data structure

<p>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.

<p>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`.


\htmlonly
Go to the <a href="perlmod_tree.html">next</a> section or return to the
 <a href="index.html">index</a>.
\endhtmlonly

*/