develooper Front page | perl.perl5.porters | Postings from July 2011

[perl #95034] [PATCH] Use a tempdir & proper filename when viewing a URL via perldoc so the header is displayed correctly(-ish)

Thread Next
From:
Father Chrysostomos via RT
Date:
July 24, 2011 10:48
Subject:
[perl #95034] [PATCH] Use a tempdir & proper filename when viewing a URL via perldoc so the header is displayed correctly(-ish)
Message ID:
rt-3.6.HEAD-7815-1311529695-1050.95034-15-0@perl.org
On Mon Jul 18 03:12:40 2011, claes wrote:
> This is a bug report for perl from claes@surfar.nu,
> generated with the help of perlbug 1.39 running under perl 5.14.1.
> 

> diff --git a/dist/Pod-Perldoc/lib/Pod/Perldoc.pm
b/dist/Pod-Perldoc/lib/Pod/Perldoc.pm
> index b8c9181..f120cb2 100644
> --- a/dist/Pod-Perldoc/lib/Pod/Perldoc.pm
> +++ b/dist/Pod-Perldoc/lib/Pod/Perldoc.pm
> @@ -728,9 +728,13 @@ sub grand_search_init {
>              require File::Temp;
>              my $response = HTTP::Tiny->new->get($_);
>              if ($response->{success}) {
> -                my ($fh, $filename) = File::Temp::tempfile(UNLINK => 1);
> -                $fh->print($response->{content});
> -                push @found, $filename;
> +                my $filename = $_ =~ m{.*/([^/#?]+)} ? $1 :
"Unknown.pod";
> +                my $dir = File::Temp::tempdir(CLEANUP => 1);
> +                my $path = catfile $dir, $filename;
> +                open my $fh, ">", $path or die "Can't open $filename:
$!";
> +                print $fh $response->{content};
> +                push @found, $path;
> +                close $fh;
>              }
>              else {

That approach won’t work for really long base names. And on Windoze it
will fail with base names containing : or consisting of ‘prn’ or a few
other special names. On VMS it won’t work with multiple dots in the file
name.

Where exactly is the header set? Maybe that piece of code could be
modified. Does Pod::Man need a new option, perhaps?


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About