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

[MacPerl] problem with LWP



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.

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

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