Icon for Dimension.orgIcon for TalentIcon for ToolsIcon for Doorways.org
Icon for ToolsIcon for Perl Tools

DoxyFilt: POD/Item/Code/Code.pm Source File

  • Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List

POD/Item/Code/Code.pm

Go to the documentation of this file.
00001 package Doxygen::POD::Item::Code;
00002 
00003 =head1 NAME
00004 
00005 Doxygen::POD::Item::Code - Perl extension for generating Doxygen documentation
00006 
00007 =head1 SYNOPSIS
00008 
00009     my  $item = new Doxygen::POD::Item::Code;
00010 
00011 =head1 ABSTRACT
00012 
00013 A block of source code in a POD source file.
00014 
00015 =head1 DESCRIPTION
00016 
00017 =head1 METHODS
00018 
00019 =over
00020 
00021 =cut
00022 
00023 use     5.005;  # just to pick something, but not really tested
00024 use     strict;
00025 use     warnings;
00026 use     UNIVERSAL   qw(isa);
00027 
00028 use     base    qw(Doxygen::POD::Item);
00029 
00030 our $VERSION = '0.01';
00031 
00032 ###########################################################################
00033 ###########################################################################
00034 
00035 =item   C<massage($self, $source)>
00036 
00037 Convert all the comment text in this block from POD formatting
00038 sequences into Doxygen formatting sequences.
00039 
00040 =cut
00041 
00042 sub massage     # $self, $source
00043 {
00044     my ($self, $source) = @_;
00045     
00046     return unless isa $self->text('comment'), 'ARRAY';
00047     
00048     my  $indent = -1;
00049     
00050     for (@{$self->text('comment')}) {
00051         next if ref($_);
00052         next unless /\S/;
00053         
00054         my ($space) = /^( *)\S/;
00055         
00056         next unless defined $space;
00057         
00058         my  $len = length($space);
00059         
00060         if ($indent < 0) {
00061             $indent = $len;
00062         } elsif ($indent > $len) {
00063             $indent = $len;
00064         }
00065     }
00066     
00067     return if $indent < 0;
00068     
00069     my  @text = ( );
00070     
00071     for (@{$self->text('comment')}) {
00072         if (ref($_)) {
00073             push @text, $_;
00074         } else {
00075             push @text, length($_) > $indent ? substr($_, $indent) : $_;
00076         }
00077     }
00078     
00079     while (@text && $text[0]      && $text[0]      !~ /\S/) {
00080         $self->{prelines}++;
00081         shift @text;
00082     }
00083     
00084     while (@text && $text[$#text] && $text[$#text] !~ /\S/) {
00085         $self->{postlines}++;
00086         pop @text;
00087     }
00088     
00089     $self->textClear ('comment');
00090     $self->textAppend('comment', @text);
00091 }
00092 
00093 ###########################################################################
00094 ###########################################################################
00095 
00096 =item   C<generate($self, %flags)>
00097 
00098 Generates output understandable by doxygen to standard output.
00099 
00100 =cut
00101 
00102 sub generate    # $self, %flags
00103 {
00104     my  $self = shift;
00105     
00106     if ($self->{prelines}) {
00107         Doxygen::Item::genThing("\n", @_)
00108             for 1..$self->{prelines};
00109     }
00110     
00111     Doxygen::Item::genThing("\@code\n", @_);
00112     $self->SUPER::generate(@_);
00113     Doxygen::Item::genThing("\@endcode\n", @_);
00114     
00115     if ($self->{postlines}) {
00116         Doxygen::Item::genThing("\n", @_)
00117             for 1..$self->{postlines};
00118     }
00119         
00120     die $@ if $@
00121 }
00122 
00123 ###########################################################################
00124 ###########################################################################
00125 
00126 1
00127 
00128 __END__
00129 
00130 =back
00131 
00132 =head1 SEE ALSO
00133 
00134 DoxyFilt.pl Doxygen::Item Doxygen::POD::Item
00135 
00136 =head1 AUTHOR
00137 
00138 Marc M. Adkins, L<mailTo:Perl@Doorways.org>
00139 
00140 =head1 COPYRIGHT AND LICENSE
00141 
00142 Copyright 2004 by Marc M. Adkins
00143 
00144 This library is free software; you can redistribute it and/or modify
00145 it under the same terms as Perl itself.
00146 
00147 =cut

Generated on Mon Dec 27 2010 15:15:39 for DoxyFilt by  doxygen 1.7.1

www.dimension.org logo

(C)opyright 1998 - 2012 Dimension.org

WebMaster