Pathname from URL

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Looking for Perl code to convert a URL like

to a Unix pathname like

The same sort of thing that wget -x does.

Even better if it offers the option of honouring the
Content-disposition HTTP header.

Thanks in advance !

André Majorel
Endless variations make it all seem new
Can you recognise the patterns that you find ?

Re: Pathname from URL

Quoted text here. Click to load it

The generalt module for parsing URL's would be This will help
you with parsing the url into the individual parts. Putting this
together into the actual filename is probably something you'll need to
do yourself.


Re: Pathname from URL

Στις 16/4/2014 12:28, ο/η Andre Majorel έγραψε:
Quoted text here. Click to load it

use strict;
use warnings;
use feature qw/say/;
use URI;

my $url    = URI->new(' ');
my $scheme = $url->scheme;

(my $what_you_want = $url->canonical)=~s/^$scheme:\/\///;
say $what_you_want;

Site Timeline