memo.xight.org

/ / memo.xight.org

2004-10-06

WWW::Mechanize

- Summary
  LWP::UserAgentのサブクラス

- https://で始まるSSL使用サイトに接続するには
  IO::Socket::SSLとCrypt::SSLeay,またはNet::SSLeayモジュールが必要.

- Proxyを使用するには
$self->proxy(['http', 'ftp'], 'http://proxy.example.com:8000/');


  または,環境変数HTTP_PROXY,HTTPS_PROXYを設定しておけば,コンストラクタ内で
$self->env_proxy();

  が呼び出されるのでOK.

- フォームフィールドの取得
  全てのフォームフィールドについて,フィールド名,タイプ,値を書き出すスクリプト
use WWW::Mechanize;
my $url = "http://www.example.com/form.html";
my $mech = WWW::Mechanize->new( cookie_jar => undef );
my $response = $mech->get( $url );
foreach my $form ($mech->forms) {
	foreach my $input ($form->inputs) {
		printf("%s (%s) ... %s\n", $input->name, $input->type, $input->value);
	}
}


- "input 'fieldname' is readonly" のエラー
  hiddenフィールドの値を変更しようとした場合のWarning
  hiddenフィールドの値を変更するならWarningをOffにしてから.
{
	local $^W = 0;
	$agent->field( name => $value );
}


- Reference
WWW-Mechanize

  Walrus, Digit. - Perlモジュール/WWW::Mechanize
  http://digit.que.ne.jp/work/?Perl%A5%E2%A5%B8%A5%E5%A1%BC%A5%EB%2FWWW%3A%3AMechanize

  Perldoc.jp - Modules - WWW-Mechanize
  http://perldoc.jp/docs/modules/WWW-Mechanize-1.02/
カテゴリ: [Perl]
2004-10 /

Color Reference

ChangeLogを検索
携帯電話からアクセス!

カテゴリ

最近の話題

リンク

過去ログ

Google

QR Code

Since
2002-11-28
Update
2008-12-02 10:52
Copyright © 2005 xight.org All Rights Reserved.