如何使用Doxygen和Doxygen :: Filter :: Perl生成Perl子例程的文档? [英] How to use Doxygen and Doxygen::Filter::Perl to generate documentation for Perl sub routines?
问题描述
我试图弄清楚如何使用 Doxygen :: Filter :: Perl
生成Perl文件的文档。我从一个非常简单的文件开始,只是看我是否可以使它正常工作( test_doxygen.pl
):
I am trying to figure out how to use Doxygen::Filter::Perl
to generate documentation for Perl files. I am starting with a very simple file just to see if I can get it to work (test_doxygen.pl
):
#! /usr/bin/env perl
#** @file test_doxygen.pl
# @brief Testing Doxygen using Doxygen::Filter::Perl
#
# Description of the purpose of this file
#
# @author Håkon Hægland (hakon.hagland@gmail.com)
#
# @bug No known bugs.
#
#*
#** @class main
# The main class
#*
use strict;
use warnings;
my $b = add_one(1);
#** @function public add_one ($par1)
# @brief A brief description of the function
#
# A detailed description of the function
# @params $par1 required A number
# @retval value Input value plus one1
#*
sub add_one {
my ($par1) = @_;
return $par1 + 1;
}
然后我安装了Doxygen :: Filter :: Perl并使用了 Doxyfile
配置文件,由软件包维护者在metacpan.org提供(链接在此处)
,并将其放在与上面脚本相同的目录中。我在 Doxyfile
中更改了一行: INPUT
标记的值已从 lib更改
到空字符串,以便仅在当前目录中搜索源文件。
I then installed Doxygen::Filter::Perl and used the Doxyfile
configuration file provided by the package maintainer at metacpan.org (the link is here)
and put it in the same directory as the script above. I changed one line in the Doxyfile
: the value of the INPUT
tag was changed from lib
to the empty string, in order to only search the current directory for source files..
我正在使用Ubuntu 14.04,因此我安装了Doxygen使用 sudo apt-get install doxygen
,(我还需要安装 graphviz
: sudo apt -get install graphviz
)然后我终于运行
I am using Ubuntu 14.04, so I installed Doxygen with sudo apt-get install doxygen
, (I also needed to install graphviz
: sudo apt-get install graphviz
) then I finally run
$ doxygen
从终端窗口。生成的HTML文件 doc / html / index.html
包含有关文件和作者的文档,但不包含 add_one <的任何文档。 / code>子例程。
from the terminal window. The generated HTML file doc/html/index.html
contains documentation about the file and the author, but it does not contain any documentation for the add_one
sub routine.
我在这里缺少什么?
更新
这是Chromium浏览器中类视图的外观:
Here is how the class view looks like in Chromium browser:
如所见,没有参考/链接到 add_one
子例程。
As seen, there is no reference/link to the add_one
sub routine.
这是文件视图:
推荐答案
所以问题出在处理 my变量声明上。它将值设置为私有:doxygen永不退缩。我在Perl.pm中添加了一行来解决此问题,它现在应该对您有用。由于您使用的是pl文件而不是pm文件,因此我也对Doxyfile进行了更改,因此您将需要从发行版中获取新文件。我已经向Github和CPAN发布了1.71,并使用您的确切示例对其进行了测试。
So the problem was with handling the "my" variable declaration. It set the value to be private: and doxygen never went back. I have added a line to Perl.pm to fix this and it should work for you now. Since you are working with pl files not pm files, I have also made changes to the Doxyfile, so you will want to get the new one from the distribution. I have published 1.71 to Github and CPAN and have tested it with your exact example.
这篇关于如何使用Doxygen和Doxygen :: Filter :: Perl生成Perl子例程的文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!