LWP::Debug

| コメント(0)

LWP::UserAgent なんかのモジュールをつかって HTTP クライアントとなるようなプログラムを作ってたんだけど、急に動かなくなった。デバッグ出力したんだけど、もとのコードは書き換えたくない。

そんなときは LWP::Debug。以下のように -M で指定してあげればLWPの要所要所でデバッグ出力してくれます。

$ perl -MLWP::Debug=+ ./http_client.pl
LWP::UserAgent::new: ()
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: GET http://example.com/
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::Protocol::collect: read 777 bytes
LWP::Protocol::collect: read 610 bytes
LWP::UserAgent::request: Simple response: OK
Comments

コメントする