tags:

views:

312

answers:

2

I am trying to download and output to a file using cURL in a Perl script.

1) I have to pass username and password in the following below. What switch should I use?

2) When I execute Perl script, this is what I get:

Can't locate WWW/Curl.pm in @INC (@INC contains: f:/Perl/site/lib f:/Perl/lib .)
 at onesec.pl line 9.
BEGIN failed--compilation aborted at haroldonesec.pl line 9.
use WWW::Curl;
curl http://download2.emu-lochard.com/sfo1/gru?start-time=2009-08-15+00%3A00%3A00&end-time=2009-08-15+12%3A59%3A59&time-zone=GMT&metric=laeq --data --O curllaeq.txt

3) How can I use Wget to do the same?

I am using the following but getting errors:

use LWP::Simple;
wget --user=username --password=password http://download2.emu-lochard.com/sfo1/gru?start-time=2009-08-15+00%3A00%3A00&end-time=2009-08-15+12%3A59%3A59&time-zone=GMT&metric=laeq -O laeq.txt
+3  A: 

As Chris Lutz points out, you do not have WWW::Curl installed.

However, even if you did, it would not matter because the way you have tried to use the library seems completely unrelated to how the module should be used.

You should try reading the documentation for WWW::Curl and LWP::Simple.

Or, if this is all you need to do, I would use the command line utilities cURL or wget.

Sinan Ünür
It might be important to note that his errors are because he doesn't have said modules installed. But +1. And also, thanks for editing the question. I tried to but SO froze up on me.
Chris Lutz
A: 

Not to repeat the obvious (you don't have the WWW::Curl installed) but to address the other issue, the standard accepted way to pass htaccess user/passwords is just accessing the url like this:

http://username:[email protected]/bla.file

Curl, wget, and every other sensible program should be able to handle this form.

Artem Russakovskii
http://username:[email protected]/bla.fileUnfortunately,this format doesnt works
Neel
Yes, yes it does.
Artem Russakovskii
curl, wget, and LWP::Simple have better ways to supply credentials.
brian d foy
If you pass the password on the command line, its very likely that every other user on the system can see your password by running `ps`.
derobert