| 1 |
#!/usr/bin/perl |
| 2 |
# |
| 3 |
##################################################################### |
| 4 |
# This program is not guaranteed to work at all, and by using this # |
| 5 |
# program you release the author of any and all liability. # |
| 6 |
# # |
| 7 |
# You may use this code as long as you are in compliance with the # |
| 8 |
# license (see the LICENSE file) and this notice, disclaimer and # |
| 9 |
# comment box remain intact and unchanged. # |
| 10 |
# # |
| 11 |
# Script: doxygen-filter-perl # |
| 12 |
# Description: pre-filter script for doxygen # |
| 13 |
# # |
| 14 |
# Written by: Bret Jordan (jordan at open1x littledot org) # |
| 15 |
# Created: 2011-10-21 # |
| 16 |
##################################################################### |
| 17 |
# |
| 18 |
# |
| 19 |
# |
| 20 |
# |
| 21 |
use 5.8.8; |
| 22 |
use strict; |
| 23 |
use warnings; |
| 24 |
use Doxygen::Filter::Perl; |
| 25 |
use Log::Log4perl; |
| 26 |
|
| 27 |
|
| 28 |
our $VERSION = '1.71'; |
| 29 |
$VERSION = eval $VERSION; |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
# You can not have any debugging turned on if you send the data through |
| 34 |
# doxygen as it will mess up the output. So before you run "doxygen Doxyfile" |
| 35 |
# make sure you have turned off all of the debugging. This is really only |
| 36 |
# here so you can run "doxygen-filter-perl lib/some/path/to/a/perl.pm" and get |
| 37 |
# debugging output |
| 38 |
my %hDebugConfig = ( |
| 39 |
'log4perl.oneMessagePerAppender' => 1, |
| 40 |
'log4perl.rootlogger' => 'FATAL, SCREEN', |
| 41 |
'log4perl.logger.Doxygen::Filter::Perl::_ChangeState' => 'FATAL, SCREEN', |
| 42 |
'log4perl.logger.Doxygen::Filter::Perl::_ProcessDoxygenCommentBlock' => 'FATAL, SCREEN', |
| 43 |
'log4perl.logger.Doxygen::Filter::Perl::_ProcessPodCommentBlock' => 'FATAL, SCREEN', |
| 44 |
'log4perl.logger.Doxygen::Filter::Perl::_ProcessPerlMethod' => 'FATAL, SCREEN', |
| 45 |
'log4perl.logger.Doxygen::Filter::Perl::_ConvertPodFormattingToDoxygenFormat' => 'FATAL, SCREEN', |
| 46 |
'log4perl.logger.Doxygen::Filter::Perl::_RemovePerlCommentFlags' => 'FATAL, SCREEN', |
| 47 |
'log4perl.appender.SCREEN' => 'Log::Log4perl::Appender::Screen', |
| 48 |
'log4perl.appender.SCREEN.stderr' => 0, |
| 49 |
'log4perl.appender.SCREEN.Threshold' => 'DEBUG', |
| 50 |
'log4perl.appender.SCREEN.layout' => 'Log::Log4perl::Layout::PatternLayout', |
| 51 |
'log4perl.appender.SCREEN.layout.ConversionPattern' => '%-5p %L %M{1}() - %m%n', |
| 52 |
); |
| 53 |
|
| 54 |
Log::Log4perl::init(\%hDebugConfig); |
| 55 |
|
| 56 |
|
| 57 |
# Lets grab the file name that passed in to the script |
| 58 |
my $sFilename = $ARGV[0]; |
| 59 |
|
| 60 |
unless (-r $sFilename) { die "This file is not readable\n"; } |
| 61 |
|
| 62 |
$sFilename =~ /\.([a-zA-Z]{1,4})$/; |
| 63 |
my $sFileExtention = lc($1); |
| 64 |
|
| 65 |
my $filter; |
| 66 |
if ( $sFileExtention eq 'pm' || $sFileExtention eq 'pl') |
| 67 |
{ |
| 68 |
$filter = new Doxygen::Filter::Perl(); |
| 69 |
$filter->ReadFile($sFilename); |
| 70 |
$filter->ProcessFile(); |
| 71 |
$filter->PrintAll(); |
| 72 |
} |
| 73 |
|
| 74 |
# Used for debugging |
| 75 |
#use Data::Dumper; |
| 76 |
#$Data::Dumper::Indent = 1; |
| 77 |
#print Dumper($filter->{'_hData'}); |
| 78 |
|
| 79 |
|