[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] problem with LWP



At 9:21 AM -0500 12/9/99, Christopher F. Baum wrote:
>I have been trying to use HTTP::Request to access an FTP server and get
>files from it. When I run this in perl on UNIX (5.005_03 for aix), it works
>just fine. When I run it on MacPerl, 5.2.0r4, it says that
>lib:LWP:Protocol:ftp.pm needs Net::FTP version 2. The version of Net::FTP
>distrbuted with MacPerl is 1.01. I tried installing the latest version of
>Net::FTP from CPAN, but that causes other errors. Here is the code fragment
>that should work (the URL is wrapped, but not in original source):
>
>use LWP::UserAgent;
>$ua = new LWP::UserAgent;
>$ua->agent("AgentName/0.1 " . $ua->agent);
>$req = HTTP::Request->new(GET =>
>'ftp://ftp.bc.edu/pub/user/baum/RePEc/boc/bocode/bocodex.rdf');
>$req->content_type('text/plain');
>   my $res = $ua->request($req);
># Check the outcome of the response
>   if ($res->is_success) {
>       print "";
>   } else {
>       print $res->code;
>       print $res->message;
>   }
>
>I looked in the list archives for postings on FTP, but didn't see anything
>that discussed this problem.

First, get the latest libwww-perl (5.47) from CPAN, if you haven't 
already, and install it.  Do the same thing with libnet (1.0607), 
which includes Net::FTP.   Verify that your site_perl comes before 
:MacPerl Ÿ:lib, or remove the old versions by hand.  If you've done 
it right, the following:

use Net::FTP;
print $Net::FTP::VERSION,"\n";
use LWP;
print $LWP::VERSION,"\n";

should give you:

2.53
5.47

Then try your script again, and, if it doesn't work, *send us the 
error messages*.  If the installation of either doesn't work for some 
reason, *send us the error messages*.  When I run your script here 
(iBook, MacOS 9, latest everything installed), it works.

>
>Thanks
>Kit
>-----------------------------------------------------------------
>Kit Baum    baum@bc.edu    http://fmwww.bc.edu/ec-v/baum.fac.html

--
Paul Schinder
schinder@pobox.com

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org