[prog] [Perl] chop URL to get filename

Jacinta Richardson jarich at perltraining.com.au
Mon Apr 30 23:42:56 UTC 2007


Anicka Bernathova wrote:
>>you might do:
>>
>>    system ("$wget $fetch_file");
>>    # Check whether anything went wrong
>>    if( $? ) {
>>        die "Failed to wget file.";
>>    }
>>
> 
> 
> I think that even better would be to avoid calling system wget and use
> LWP (module libwww-perl on cpan) instead.
> Example see ie. here:  http://www.perl.com/pub/a/2002/08/20/perlandlwp.html

I agree, but I suspected that the OP might just have wanted to get the job done
now (and once) rather than installing extra modules.  Certainly if this is to be
a long term project, LWP is a much better choice.

	J


-- 
   ("`-''-/").___..--''"`-._          |  Jacinta Richardson         |
    `6_ 6  )   `-.  (     ).`-.__.`)  |  Perl Training Australia    |
    (_Y_.)'  ._   )  `._ `. ``-..-'   |      +61 3 9354 6001        |
  _..`--'_..-_/  /--'_.' ,'           | contact at perltraining.com.au |
 (il),-''  (li),'  ((!.-'             |   www.perltraining.com.au   |


More information about the Programming mailing list