Net::FTP
- Practically everything Internet-related has a module for it.
#!perl -w
use strict;
use Net::FTP;
my $ftp = Net::FTP->new('ftp.fsc.follett.com');
$ftp->login('anonymous','me@mysite.com');
$ftp->cwd('/ds/dropoff/');
$ftp->get('schooldata.zip');
libwww-perl
- Called "LWP" for short
- Includes HTTP, HTML, XML, etc etc etc
#!perl -w
use strict;
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Response;
my $ua = LWP::UserAgent->new();
$ua->agent( "PageFetcher/1.0" );
for my $base ( qw( cnn oracle follett ) ) {
my $url = "http://www.$base.com";
my $req = HTTP::Request->new( GET => $url );
my $response = $ua->request( $req );
if ( $response->is_error() ) {
print "$url: Error: ", $response->status_line, "\n";
} else {
my $title = $response->title();
my $len = length $response->content();
print "$url: $title ($len bytes)\n";
}
} # for http://www.cnn.com: CNN Interactive (66962 bytes)
http://www.oracle.com: Oracle Corporation - Home (11842 bytes)
http://www.follett.com: Follett Corporation Home Page (21564 bytes)
|
|
|