Pathname from URL

Discussion in 'Perl Misc' started by Andre Majorel, Apr 16, 2014.

  1. 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 !
    Andre Majorel, Apr 16, 2014
    1. Advertisements

  2. 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.

    Peter Makholm, Apr 16, 2014
    1. Advertisements

  3. Στις 16/4/2014 12:28, ο/η Andre Majorel έγÏαψε:

    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;
    George Mpouras, Apr 18, 2014
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.