diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-09-18 14:17:50 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-09-18 14:20:38 -0700 |
commit | 8fe353ef0987121ae6b17c9dbd86962f54a703c0 (patch) | |
tree | 45294ceb5932662d6d6cca5e3b099a2d898425ba /dist/Pod-Perldoc | |
parent | 47ec1fa66f2d45e2b6fc356188c2676af3ec447c (diff) | |
download | perl-8fe353ef0987121ae6b17c9dbd86962f54a703c0.tar.gz |
[perl #95034] Make perldoc <url> use a reasonabe name
This patch makes perldoc with a URL use a somewhat reasonable name
based on the basename of the URL, instead of displaying PALLEGCSYO or
BJ1KKH1675 in the pod header (based on the tmp file name).
It treats all URLs the same (changing perldoc.pod to PERLDOC), instead
of treating .pm’s specially. Maybe this could be improved later.
Diffstat (limited to 'dist/Pod-Perldoc')
-rw-r--r-- | dist/Pod-Perldoc/lib/Pod/Perldoc.pm | 10 | ||||
-rw-r--r-- | dist/Pod-Perldoc/lib/Pod/Perldoc/ToMan.pm | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/dist/Pod-Perldoc/lib/Pod/Perldoc.pm b/dist/Pod-Perldoc/lib/Pod/Perldoc.pm index b8c91812f8..cdfea459ad 100644 --- a/dist/Pod-Perldoc/lib/Pod/Perldoc.pm +++ b/dist/Pod-Perldoc/lib/Pod/Perldoc.pm @@ -12,7 +12,7 @@ use File::Spec::Functions qw(catfile catdir splitdir); use vars qw($VERSION @Pagers $Bindir $Pod2man $Temp_Files_Created $Temp_File_Lifetime ); -$VERSION = '3.15_06'; +$VERSION = '3.15_07'; #.......................................................................... BEGIN { # Make a DEBUG constant very first thing... @@ -731,6 +731,9 @@ sub grand_search_init { my ($fh, $filename) = File::Temp::tempfile(UNLINK => 1); $fh->print($response->{content}); push @found, $filename; + ($self->{podnames}{$filename} = + m{.*/([^/#?]+)} ? uc $1 : "UNKNOWN") + =~ s/\.P(?:[ML]|OD)\z//; } else { print STDERR "No " . @@ -1141,6 +1144,11 @@ sub render_findings { $self->{'output_is_binary'} = $formatter->can('write_with_binmode') && $formatter->write_with_binmode; + if( $self->{podnames} and exists $self->{podnames}{$file} and + $formatter->can('name') ) { + $formatter->name($self->{podnames}{$file}); + } + my ($out_fh, $out) = $self->new_output_file( ( $formatter->can('output_extension') && $formatter->output_extension ) || undef, diff --git a/dist/Pod-Perldoc/lib/Pod/Perldoc/ToMan.pm b/dist/Pod-Perldoc/lib/Pod/Perldoc/ToMan.pm index 09b0e81737..f456a2475a 100644 --- a/dist/Pod-Perldoc/lib/Pod/Perldoc/ToMan.pm +++ b/dist/Pod-Perldoc/lib/Pod/Perldoc/ToMan.pm @@ -26,6 +26,7 @@ sub fixed { shift->_perldoc_elem('fixed' , @_) } sub fixedbold { shift->_perldoc_elem('fixedbold' , @_) } sub fixeditalic { shift->_perldoc_elem('fixeditalic' , @_) } sub fixedbolditalic { shift->_perldoc_elem('fixedbolditalic', @_) } +sub name { shift->_perldoc_elem('name' , @_) } sub quotes { shift->_perldoc_elem('quotes' , @_) } sub release { shift->_perldoc_elem('release' , @_) } sub section { shift->_perldoc_elem('section' , @_) } |