Perl::Critic::Utils::POD - Utility functions for dealing with POD. |
Perl::Critic::Utils::POD - Utility functions for dealing with POD.
use Perl::Critic::Utils::POD qw< get_pod_section_from_file >;
my $synopsis = get_pod_section_from_file('Perl/Critic/Utils/POD.pm', 'SYNOPSIS');
my $see_also = get_pod_section_from_filehandle($file_handle, 'SEE ALSO');
my $see_also_content = trim_pod_section($see_also);
# "Utility functions for dealing with POD." my $module_abstract = get_module_abstract_from_file('Perl/Critic/Utils/POD.pm');
my $module_abstract = get_module_abstract_from_filehandle($file_handle);
Provides means of accessing chunks of POD.
This is considered to be a public module. Any changes to its interface will go through a deprecation cycle.
get_pod_file_for_module( $module_name )
This depends upon the module already being loaded; it will not find the path for arbitrary modules.
If there is a file with a ``.pod'' extension next to the real module location, it will be returned in preference to the actual module.
get_raw_pod_section_from_file( $file_name, $section_name )
=head1
) from the file. This is uninterpreted; escapes are not
processed and any sub-sections will be present. E.g. if the content
contains ``C<$x>'', the return value will contain ``C<$x>''.
Returns nothing if no such section is found.
Throws a Perl::Critic::Exception::IO if there's a problem with the file.
get_raw_pod_section_from_filehandle( $file_handle, $section_name )
get_raw_pod_section_from_file()
, but with a file
handle.
get_raw_pod_section_from_string( $source, $section_name )
get_raw_pod_section_from_file()
, but with a string
that contains the raw POD.
get_raw_pod_section_for_module( $module_name, $section_name )
get_raw_pod_section_from_file()
, but with a module
name.
Throws a Perl::Critic::Exception::Generic if a file containing POD for the module can't be found.
get_pod_section_from_file( $file_name, $section_name )
=head1
) from the file. This is interpreted into plain text.
Returns nothing if no such section is found.
Throws a Perl::Critic::Exception::IO if there's a problem with the file.
get_pod_section_from_filehandle( $file_handle, $section_name )
get_pod_section_from_file()
, but with a file
handle.
get_pod_section_from_string( $source, $section_name )
get_pod_section_from_file()
, but with a string
that contains the raw POD.
get_pod_section_for_module( $module_name, $section_name )
get_pod_section_from_file()
, but with a module
name.
Throws a Perl::Critic::Exception::Generic if a file containing POD for the module can't be found.
trim_raw_pod_section( $pod_section )
=item1 BLAH
removed and all leading and trailing whitespace (including newlines)
removed after that.
For example, using one of the get_raw_pod_section_from_*
functions
to get the ``NAME'' section of this module and then calling
trim_raw_pod_section()
on the result would give you
``Perl::Critic::Utils::POD - Utility functions for dealing with POD.''.
trim_pod_section( $pod_section )
Since this cannot count upon a =item1
marker, this is much less
reliable than trim_raw_pod_section()
.
get_raw_module_abstract_from_file( $file_name )
Example ``well formed'' ``NAME'' sections without abstracts:
Some::Module
Some::Other::Module -
Example ``NAME'' sections that will result in an exception:
Some::Bad::Module This has no hyphen.
Some::Mean::Module -- This has double hyphens.
Some::Nasty::Module - This one attempts to span multiple lines.
get_raw_module_abstract_from_filehandle( $file_handle )
get_raw_module_abstract_from_file()
, but with a
file handle.
get_raw_module_abstract_from_string( $source )
get_raw_module_abstract_from_file()
, but with a
string that contains the raw POD.
get_raw_module_abstract_for_module( $module_name )
get_raw_module_abstract_from_file()
, but for a
module name.
get_module_abstract_from_file( $file_name )
get_raw_module_abstract_from_file()
, but with
escapes interpreted.
get_module_abstract_from_filehandle( $file_handle )
get_module_abstract_from_file()
, but with a file
handle.
get_module_abstract_from_string( $source )
get_module_abstract_from_file()
, but with a string
that contains the raw POD.
get_module_abstract_for_module( $module_name )
get_module_abstract_from_file()
, but for a module
name.
Elliot Shank <perl@galumph.com>
Copyright (c) 2008-2011 Elliot Shank.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module.
Perl::Critic::Utils::POD - Utility functions for dealing with POD. |