libwww-perl-5.836 > LWP::Debug
libwww-perl-5.836

名前

LWP::Debug - deprecated

LWP::Debug - 非推奨

説明

LWP::Debug used to provide tracing facilities, but these are not used by LWP any more. The code in this module is kept around (undocumented) so that 3rd party code that happen to use the old interfaces continue to run.

LWP::Debug はトレース機能を提供するために使われていましたが、 これらはもはや LWP によって使われなくなくなりました。 このモジュールのコードは(文書化されずに)維持されているため、 たまたま古いインターフェイスを使用するサードパーティのコードは 動作し続けます。

One useful feature that LWP::Debug provided (in an imprecise and troublesome way) was network traffic monitoring. The following section provide some hints about recommened replacements.

LWP::Debug が(不正確で厄介な方法で)提供した便利な機能の一つは、 ネットワークトラフィックの監視でした。 次の節では、推奨される置き換え方についてのヒントを示します。

ネットワークトラフィック監視

The best way to monitor the network traffic that LWP generates is to use an external TCP monitoring program. The Wireshark program (http://www.wireshark.org/) is higly recommended for this.

LWP が生成するネットワークトラフィックを監視する最良の方法は、 外部 TCP 監視プログラムを使うことです。 このためには、Wireshark プログラム (http://www.wireshark.org/) を お勧めします。

Another approach it to use a debugging HTTP proxy server and make LWP direct all its traffic via this one. Call $ua->proxy to set it up and then just use LWP as before.

もう一つの手法は、デバッグ用の HTTP プロキシサーバを使って、 LWP がすべてのトラフィックをこのプロキシサーバ経由で 送信するようにすることです。 $ua->proxy を呼び出して設定し、前と同じように LWP を使用します。

For less precise monitoring needs just setting up a few simple handlers might do. The following example sets up handlers to dump the request and response objects that pass through LWP:

より精度の低い監視でよい場合は、いくつかの単純なハンドラを 設定するだけで十分です。 次の例では、LWP を通過するリクエストオブジェクトとレスポンスオブジェクトを ダンプするハンドラを設定します。

  use LWP::UserAgent;
  $ua = LWP::UserAgent->new;
  $ua->default_header('Accept-Encoding' => scalar HTTP::Message::decodable());

  $ua->add_handler("request_send",  sub { shift->dump; return });
  $ua->add_handler("response_done", sub { shift->dump; return });

  $ua->get("http://www.example.com");

SEE ALSO

LWP::UserAgent