68user's page 掲示板

Prev< No. 4816> Next  [最新発言に戻る] [過去ログ一覧]
No. 4816 # 68user 2007/07/21 (土) 02:54:23
>>4815 mac
HTTP::Response の code メソッドを使えばよいと思います。

-----
#!/usr/local/bin/perl
use strict;
use HTTP::Request::Common;
use LWP::UserAgent;

my $req = POST( 'http://X68000.q-e-d.net/~68user/net/sample/http-auth/secret.html');
$req->authorization_basic('hoge', 'wrong-password');
my $ua = LWP::UserAgent->new;
my $res = $ua->request($req);
print $res->code."\n";

my $req2 = POST( 'http://X68000.q-e-d.net/~68user/net/sample/http-auth/secret.html');
$req2->authorization_basic('hoge', 'fuga');
my $ua2 = LWP::UserAgent->new;
my $res2 = $ua2->request($req2);
print $res2->code."\n";

Prev< No. 4816> Next  [最新発言に戻る] [過去ログ一覧]