(Scroll down for an answer to your latest question ...)

Strange that there is no available module that seems to cope rightly ith this URI. Or maybe is the URI to be "non standard

Your URI is fine (until you added a space at the start, heh). The module is maybe what is "non-standard," I am afraid.

First the problem addressed by Perlbotics' patch; the method $ff->output_file not being a method to set the value, as it would appear to be.

Then the ungraceful handling of a problem URI (e.g. with a leading space as in your OP):

my $url = ' http://www.perlmonks.com/foo?bar=baz'; print "Downloading >$url<\n"; # note use of delimiters to make a stray + # leading space more visible in your deb +ug my $ff = File::Fetch->new(uri => $url); say "scheme: " . $ff->scheme; say "host: " . $ff->host; say "path: " . $ff->path; say "file: " . $ff->file; say "output_file: " . $ff->output_file;
## outputs: Use of uninitialized value in concatenation (.) or string at ./foo.pl +line 10. scheme: # <- error host: http: # <- error path: //www.perlmonks.com/ # <- error file: foo?bar=baz output_file: foo

These two things alone would make me consider looking for a different solution on CPAN.

Now I just have to figure out how to get the right file name out of the URI.

You are on the right track with a path-parsing module. But if all your files are of the format you showed, you might want to use a regexp:

#!/usr/bin/env perl -w use strict; my $url = 'http://www.ekey.net/downloads-475?download=2132cbe2-2fb1-ee +ff-583c-50a39b6aba6c&name=v2_ITA_12-Seiter_Programm_1207_web.pdf'; (my $output_name = $url) =~ s/^.*name=(.*)$/$1/; print "$output_name\n"; __END__
## outputs: v2_ITA_12-Seiter_Programm_1207_web.pdf
Remember: Ne dederis in spiritu molere illegitimi!

In reply to Re^3: Fetch Problem uri by 1nickt
in thread Fetch Problem uri by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.