NAME
Gimp::Pod - Evaluate pod documentation embedded in scripts.
SYNOPSIS
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);
DESCRIPTION
Gimp::Pod
can be used to find and parse embedded pod documentation in Gimp-Perl scripts, returning formatted text.
FUNCTIONS
- fixup_args
-
fixup_args
is 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:- $function
-
Defaults to the NAME section of the POD, the part before the first
-
. Falls back to the script's filename. - $blurb
-
Defaults to the NAME section of the POD, the part after the first
-
. - $help
-
Defaults to the DESCRIPTION section of the POD.
-
Defaults to the AUTHOR section of the POD.
- $copyright
-
Defaults to the LICENSE section of the POD.
- $date
-
Defaults to the DATE section of the POD.
-
Defaults to the SYNOPSIS section of the POD.
- $imagetypes
-
Defaults to the "IMAGE TYPES" section of the POD.
- $params
-
Defaults to the "PARAMETERS" section of the POD, passed to
eval
, e.g.:=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.
- $results
-
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. - $other
-
Untouched. Must be supplied - will normally be the code reference.
- make_arg_line
-
make_arg_line
is 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 topodregister
. It takes as arguments, the output offixup_args
, and returns the text to be inserted (possibly an empty string).
METHODS
- new
-
Return a new Gimp::Pod object representing the current script or undef, if an error occured.
- section(@headers)
-
Return the section with the header described by
@headers
, the first being ahead1
, the second <head2>, etc, or undef if not found. There is no trailing newline on the returned string. - sections(@headers)
-
Returns a list of section titles found in the pod, described similarly to above.
AUTHOR
Marc Lehmann <pcg@goof.com>. Rewritten to eliminate external executables by Ed J.
SEE ALSO
perl(1), Gimp