How to use Doxygen and Doxygen::Filter::Perl to ge

2020-06-19 02:37发布

问题:

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;
}

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

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

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.

What am I missing here?

Update

Here is how the class view looks like in Chromium browser:

As seen, there is no reference/link to the add_one sub routine.

And here is the file view:

回答1:

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.



回答2:

I just posted a new version of Doxygen::Filter::Perl to Github and CPAN, version 1.70. This should fix the problems you were seeing.



回答3:

I just looked at this and it seems to work with Doxygen (1.7.5.1), however, the newer version of Doxygen (1.8.9.1) does not seem to work well.



标签: perl doxygen