Gimp::Pod - Evaluate pod documentation embedded in scripts.
use Gimp::Pod; my $pod = Gimp::Pod->new; my $synopsis = $pod->section('SYNOPSIS'); my @temp_procs = $pod->sections('TEMPORARY PROCEDURES'); my $text = $pod->section('TEMPORARY PROCEDURES', 'p1 - x', 'PARAMETERS'); my @args = fixup_args(@register_args);
Gimp::Pod can be used to find and parse embedded pod documentation in Gimp-Perl scripts, returning formatted text.
fixup_argsis exported by default. It takes a list of arguments, and for all the scalar arguments, will (if they are false) extract them from various parts of the calling script's POD documentation, and then return the fixed-up list:
Defaults to the NAME section of the POD, the part before the first
-. Falls back to the script's filename.
Defaults to the NAME section of the POD, the part after the first
Defaults to the DESCRIPTION section of the POD.
Defaults to the AUTHOR section of the POD.
Defaults to the LICENSE section of the POD.
Defaults to the DATE section of the POD.
Defaults to the SYNOPSIS section of the POD.
Defaults to the "IMAGE TYPES" section of the POD.
Defaults to the "PARAMETERS" section of the POD, passed to
=head PARAMETERS [ PF_COLOR, 'color', 'Colour', 'black' ], [ PF_FONT, 'font', 'Font', 'Arial' ],
You don't have to indent it so that POD treats it as verbatim, but it will be more readable in any POD viewer if you do. If you pass in a true non-ref value, it will be evaluated as though it had been read from the POD.
Defaults to the "RETURN VALUES" section of the POD, passed to
eval. Not providing the relevant POD section is perfectly valid, so long as you intend to return no values. As above, if passed a true non-ref value, it will be evaluated.
Untouched. Must be supplied - will normally be the code reference.
make_arg_lineis exported by default. It is used by source filters in Gimp::Fu and Gimp::Extension to generate the line inserted at the start of functions passed to
podregister. It takes as arguments, the output of
fixup_args, and returns the text to be inserted (possibly an empty string).
Return a new Gimp::Pod object representing the current script or undef, if an error occured.
Return the section with the header described by
@headers, the first being a
head1, the second <head2>, etc, or undef if not found. There is no trailing newline on the returned string.
Returns a list of section titles found in the pod, described similarly to above.
Marc Lehmann <email@example.com>. Rewritten to eliminate external executables by Ed J.