1 package App
::Zealc
::UsageExtractor
;
7 our $VERSION = '0.000_001';
9 use parent qw
/Pod::Simple::Methody/;
11 use Text
::Wrap qw
/fill/;
14 my ($self, $section) = @_;
15 $self->{section
} = '';
16 $self->{insection
} = 1;
21 $self->{insection
} = 0;
22 $self->{firstpara
} = 1;
27 $self->handle_text("\n\n") unless $self->{firstpara
};
28 $self->{firstpara
} = 0;
32 my ($self, $text) = @_;
33 $self->{section
} .= $text if $self->{insection
};
34 $self->{$self->{section
}} .= $text if $self->{section
} && !$self->{insection
};
44 fill
'', '', $self->{DESCRIPTION
}
49 $self->synopsis . "\n\n" . $self->description . "\n";
59 App::Zealc::UsageExtractor - Extract SYNOPSIS and DESCRIPTION sections from a module
63 use App::Zealc::UsageExtractor;
64 my $parser = App::Zealc::UsageExtractor->new;
65 $parser->parse_file("path/to/file.pm");
67 say $parser->synopsis; # contents of synopsis section
68 say $parser->description; # contents of description, filled
69 say $parser->usage; # $parser->synopsis."\n\n".$parser->description."\n"
73 App::Zealc::UsageExtractor is a L<Pod::Simple> subclass that extracts
74 the SYNOPSIS and DESCRIPTION sections from a Pod file.
80 The SYNOPSIS section of the file
84 The DESCRIPTION section of the file, filled using L<Text::Wrap>
88 Equivalent to C<< $parser->synopsis."\n\n".$parser->description."\n" >>
98 Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
100 =head1 COPYRIGHT AND LICENSE
102 Copyright (C) 2015 by Marius Gavrilescu
104 This library is free software; you can redistribute it and/or modify
105 it under the same terms as Perl itself, either Perl version 5.20.1 or,
106 at your option, any later version of Perl 5 you may have available.
This page took 0.025136 seconds and 4 git commands to generate.