diff options
Diffstat (limited to 'Master/tlpkg/tlperl/lib/Pod/Select.pm')
-rw-r--r-- | Master/tlpkg/tlperl/lib/Pod/Select.pm | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/Master/tlpkg/tlperl/lib/Pod/Select.pm b/Master/tlpkg/tlperl/lib/Pod/Select.pm index f822d211b65..6657def58fd 100644 --- a/Master/tlpkg/tlperl/lib/Pod/Select.pm +++ b/Master/tlpkg/tlperl/lib/Pod/Select.pm @@ -11,7 +11,7 @@ package Pod::Select; use strict; use vars qw($VERSION @ISA @EXPORT $MAX_HEADING_LEVEL %myData @section_headings @selected_sections); -$VERSION = '1.60'; ## Current version of this package +$VERSION = '1.62'; ## Current version of this package require 5.005; ## requires this Perl version or later ############################################################################# @@ -71,6 +71,10 @@ podselect() =head1 DESCRIPTION +B<NOTE: This module is considered legacy; modern Perl releases (5.18 and +higher) are going to remove Pod-Parser from core and use L<Pod-Simple> +for all things POD.> + B<podselect()> is a function which will extract specified sections of pod documentation from an input stream. This ability is provided by the B<Pod::Select> module which is a subclass of B<Pod::Parser>. @@ -531,7 +535,7 @@ implicit first argument. B<podselect> will print the raw (untranslated) POD paragraphs of all POD sections in the given input files specified by C<@filelist> -according to the given options. +according to the options given in C<\%options>. If any argument to B<podselect> is a reference to a hash (associative array) then the values with the following keys are @@ -542,7 +546,8 @@ processed as follows: =item B<-output> A string corresponding to the desired output file (or ">&STDOUT" -or ">&STDERR"). The default is to use standard output. +or ">&STDERR"), or a filehandle to write on. The default is to use +standard output. =item B<-sections> @@ -565,10 +570,10 @@ are used. =back -All other arguments should correspond to the names of input files -containing POD sections. A file name of "-" or "<&STDIN" will -be interpreted to mean standard input (which is the default if no -filenames are given). +All other arguments are optional and should correspond to filehandles to +read from or the names of input files containing POD sections. A file name +of "", "-" or "<&STDIN" will be interpreted to mean standard input (which +is the default if no arguments are given). =cut @@ -581,8 +586,8 @@ sub podselect { my %opts; local $_; for (@argv) { - if (ref($_)) { - next unless (ref($_) eq 'HASH'); + my $ref = ref($_); + if ($ref && $ref eq 'HASH') { %opts = (%defaults, %{$_}); ##------------------------------------------------------------- @@ -612,12 +617,15 @@ sub podselect { #! if ( (defined $opts{'-ranges'}) #! && ((ref $opts{'-ranges'}) eq 'ARRAY') ); } - else { + elsif(!$ref || $ref eq 'GLOB') { $pod_parser->parse_from_file($_, $output); ++$num_inputs; } + else { + croak "Input from $ref reference not supported!\n"; + } } - $pod_parser->parse_from_file('-') unless ($num_inputs > 0); + $pod_parser->parse_from_file('-') unless ($num_inputs > 0); } ############################################################################# @@ -669,7 +677,7 @@ sub _compile_section_spec { ## Parse the regexs for the heading titles @regexs = split(/\//, $_, $MAX_HEADING_LEVEL); - ## Set default regex for ommitted levels + ## Set default regex for omitted levels for (my $i = 0; $i < $MAX_HEADING_LEVEL; ++$i) { $regexs[$i] = '.*' unless ((defined $regexs[$i]) && (length $regexs[$i])); |