Regarding your second problem, the docs for File::Fetch say:

$ff->output_file The name of the output file. This is the same as $ff->file, but any qu +ery parameters are stripped off. For example: http://example.com/index.html?x=y would make the output file be index.html rather than index.html?x=y.

However, output_file() is an accessor only, so you can't change the value.

UPDATE: Better explained and shown with a patch in the reply above.

You probably would like to do something like:

my $ff = File::Fetch->new(uri => $url); my $output_name = $ff->name; $ff->file =~ /name=(.*)$/ and $output_name = $1; # $output_name is now 'v2_ITA_12-Seiter_Programm_1207_web.pdf' $ff->output_file( $output_name );

... but that doesn't work.

Update: The below errors were caused by the missing space in the filename.

That's by (poor) design, but the module seems to have other problems, as the accessor methods don't seem to do what they say:

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 12. scheme: host: http: path: //www.ekey.net/ file: downloads-475?download=2132cbe2-2fb1-eeff-583c-50a39b6aba +6c&name=v2_ITA_12-Seiter_Programm_1207_web.pdf output_file: downloads-475
Remember: Ne dederis in spiritu molere illegitimi!

In reply to Re: 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.