in reply to Re: DoxygenFilter & DoxyFilt
in thread DoxygenFilter & DoxyFilt

You doesn't need DoxygenFilter to process POD

True. I could as well use Pod2html to pretty much achieve that. But I am using Doxygen, because the amount & type of documentation it generates is very useful. Organization by classes, methods, variables, searching etc. It is just way more than POD. But unfortunately Doxygen does not understand POD & that is what DoxygenFilter is trying to address - at least that is what I understood.

Replies are listed 'Best First'.
Re^3: DoxygenFilter & DoxyFilt
by zwon (Abbot) on Nov 24, 2009 at 23:20 UTC

    After looking onto examples in distribution I have a feeling that DoxygenFilter doesn't support POD. It only adds support for Doxygen style documentation, here's one of the examples:

    ## @file # Useful helpers. ## @class # Container for helper functions. package Helper; ## @cmethod Helper new() # Create a new Helper. sub new { } ## @fn $ upcase($string) # Upcase a string. # @param string a string to be upcased # @return the upper-case version of string. sub upcase { return uc(shift); } 1;

    Update: and yes DoxyFilt supports POD, so it seems it's a right tool for you.

      Well, google wasn't being particularly helpful so I figured I'll just hack the goddamn doxygenfilter for my purpose. The doxyfilter perl script that you add as INPUT_FILTER calls PerlFilter->flter() method, which does the actual processing of each script. As suspected, it does not even look for POD syntax. All you gotta do is modify it to make it work with POD. In our case any all POD open tags (=head1, =head2 etc) are always closed (=cut). So this filter method handles that & dumps out what Doxygen will understand.

      If someone wants to expand this to support full POD syntax, the following code snippet should be a good start.

      sub filter { my($self, $infile) = @_; open(my $infh, $infile); my $current_class = ""; my $file = []; while( <$infh> ) { push( @$file, $_ ); } $self->file_contents( $file ); my $objcontext = grep( /^\s*use\s+base\s/, @$file ) || grep( /\@ISA/, @$file ) || grep( /^\s*bless/, @$file ) || grep( /^\s*sub\s+new\s/, @$file ) || grep( /\$self/, @$file ); push( @$file, "" ); # in order to have a delimiting empty line at + EOF for( my $line=0; $line <= $#$file; ) { $_ = $file->[$line++]; if (/^use\s+([\w:]+)/) { my $inc = $1; $inc =~ s/::/\//g; $self->print("#include \"$inc.pm\"\n"); } elsif (/^package\s+([\w:]+)/) { if ($current_class) { $self->flush; $self->print("};\n"); } next unless( $objcontext ); $current_class = $1; $self->emit_class( $current_class, $line ); } if (/^=head\d/) { my @more; while ($_ = $file->[$line++]) { if (/^=cut/s) { last; } else { #print "DOC ---- $_"; push @more, $_; } } $_ = $file->[$line++]; while ($_ =~ /^$/) { $_ = $file->[$line++]; } if (/^\s*sub\s+([\w:]+)/) { my( $proto, $name, @args ) = $self->analyze_sub($line-1); if( $current_class && @args && ($args[0] eq "\$self") ) { $self->push($self->protection($proto).' Object Methods'); $proto =~ s/\$self,*\s*//; } elsif( $current_class && ((@args && ($args[0] eq "\$class")) || ($name eq "new") +) ) { $self->push($self->protection($proto).' Class Methods'); } else { $self->push($self->protection($proto).' Functions'); } $proto = $self->munge_parameters($proto); $self->start("\@fn $proto")->more(@more)->end; $self->print($proto, ";\n"); $self->pop; } redo if defined $_; } } $self->flush(); if ($current_class) { $self->print("};\n"); } }
      Yeah, that was the conclusion I came to. But do you know where I can download DoxyFilt & its required modules? The site doesn't list a location where I can download it. At least I couldn't find it.