#!/usr/bin/perl use warnings; use strict; use LWP::UserAgent; use HTTP::Request::Common; #unless ( scalar @ARGV == 1 ) { ... } # Apparently that would have b +een an alternative if ($#ARGV != 0) { print STDERR "Usage: $0 \"URL to fetch\"\n"; exit; } my $agent = new LWP::UserAgent; $agent->get(['http','ftp'],'http://search.cpan.org/~gaas/libwww-perl-5 +.808/lib/LWP/Simple.pm'); my $req = GET($ARGV[0]); my $res = $agent->request($req); if ($res->is_success) { print $res->content; } else { print $res->status_line,"\n"; }
In reply to Re^4: 400 URL must be absolute
by Win
in thread 400 URL must be absolute
by Win
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |