=encoding euc-jp =head1 NAME =begin original HTTP::Cookies - HTTP cookie jars =end original HTTP::Cookies - クッキー容器 =head1 SYNOPSIS use HTTP::Cookies; $cookie_jar = HTTP::Cookies->new( file => "$ENV{'HOME'}/lwp_cookies.dat', autosave => 1, ); use LWP; my $browser = LWP::UserAgent->new; $browser->cookie_jar($cookie_jar); =begin original Or for an empty and temporary cookie jar: =end original あるいは、空の容器や一時的クッキー容器の場合は: use LWP; my $browser = LWP::UserAgent->new; $browser->cookie_jar( {} ); =head1 DESCRIPTION =begin original This class is for objects that represent a "cookie jar" -- that is, a database of all the HTTP cookies that a given LWP::UserAgent object knows about. =end original このクラスは、「クッキー容器」-- これは、与えられた LWP::UserAgent オブジェクトが知っている全ての HTTP クッキーのデータベース -- を表現するためのオブジェクトのためのものです。 =begin original Cookies are a general mechanism which server side connections can use to both store and retrieve information on the client side of the connection. For more information about cookies refer to and . This module also implements the new style cookies described in I. The two variants of cookies are supposed to be able to coexist happily. =end original クッキー (Cookie) は、サーバー側の接続が接続のクライアント側に情報を格納し、 取り出すという両方が出来る一般的な機能です。 クッキーについてのさらなる情報は をご覧下さい。 このモジュールは I で記述されている新しい形式のクッキーも実装します。 クッキーの二つの変数は幸せに共存できるものと想定されます。 =begin original Instances of the class I are able to store a collection of Set-Cookie2: and Set-Cookie: headers and are able to use this information to initialize Cookie-headers in I objects. The state of a I object can be saved in and restored from files. =end original I クラスのインスタンスは Set-Cookie2: と Set-Cookie: ヘッダの集まりを格納することができ、この情報を I オブジェクトの Cookie ヘッダを初期化するために 使うことが出来ます。 I オブジェクトの状態はファイルに格納でき、ファイルから 取得することができます。 =head1 METHODS =begin original The following methods are provided: =end original 以下のメソッドが提供されます: =over 4 =item $cookie_jar = HTTP::Cookies->new =begin original The constructor takes hash style parameters. The following parameters are recognized: =end original コンストラクタはハッシュ形式のパラメータを取ります。 以下のパラメータが理解されます: =begin original file: name of the file to restore cookies from and save cookies to autosave: save during destruction (bool) ignore_discard: save even cookies that are requested to be discarded (bool) hide_cookie2: do not add Cookie2 header to requests =end original file: クッキーが取り出され、保存されるファイルの名前 autosave: オブジェクトのデストラクション処理中に保存する (bool) ignore_discard: 廃棄するように要求されたクッキーであっても保存する (bool) hide_cookie2: リクエストに Cookie2 ヘッダを追加しない =begin original Future parameters might include (not yet implemented): =end original 将来以下のパラメータが入ります (まだ実装されていません): max_cookies 300 max_cookies_per_domain 20 max_cookie_size 4096 no_cookies list of domain names that we never return cookies to =item $cookie_jar->add_cookie_header( $request ) =begin original The add_cookie_header() method will set the appropriate Cookie:-header for the I object given as argument. The $request must have a valid url attribute before this method is called. =end original add_cookie_header() メソッドは適切な Cookie:-ヘッダ を引数として 与えられた I オブジェクトに設定します。 このメソッドが呼ばれる前に、$request は適切な url 属性を 持たなければなりません。 =item $cookie_jar->extract_cookies( $response ) =begin original The extract_cookies() method will look for Set-Cookie: and Set-Cookie2: headers in the I object passed as argument. Any of these headers that are found are used to update the state of the $cookie_jar. =end original extract_cookies() メソッドは Set-Cookie: と Set-Cookie2: を引数として 渡された I から探します。 見つかったこれらのヘッダはすべて、$cookie_jar の状態を更新するために 使われます。 =item $cookie_jar->set_cookie( $version, $key, $val, $path, $domain, $port, $path_spec, $secure, $maxage, $discard, \%rest ) =begin original The set_cookie() method updates the state of the $cookie_jar. The $key, $val, $domain, $port and $path arguments are strings. The $path_spec, $secure, $discard arguments are boolean values. The $maxage value is a number indicating number of seconds that this cookie will live. A value <= 0 will delete this cookie. %rest defines various other attributes like "Comment" and "CommentURL". =end original set_cookie() メソッドは $cookie_jar の状態を更新します。 $key, $val, $domain, $port, $path 引数は文字列です。 $path_spec, $secure, $discard 引数はブール値です。 $maxage はこのクッキーが生きている秒数を示します。 値が <=0 はこのクッキーを削除します。 %rest は "Comment" や "CommentURL" のような他の様々な属性を定義します。 =item $cookie_jar->save =item $cookie_jar->save( $file ) =begin original This method file saves the state of the $cookie_jar to a file. The state can then be restored later using the load() method. If a filename is not specified we will use the name specified during construction. If the attribute I is set, then we will even save cookies that are marked to be discarded. =end original このメソッドは $cookie_jar の状態をファイルに保存します。 この状態は load() メソッドを使って取り出すことが出来ます。 もしファイル名が指定されなければ、コンストラクタで指定された 名前を使用します。 属性 I が設定されれば、廃棄するように印のついた クッキーも保存します。 =begin original The default is to save a sequence of "Set-Cookie3" lines. "Set-Cookie3" is a proprietary LWP format, not known to be compatible with any browser. The I sub-class can be used to save in a format compatible with Netscape. =end original デフォルトは "Set-Cookie3" の行の並びを保存します。 "Set-Cookie3" は LWP 専用のフォーマットです、他のブラウザとの互換性は 分かりません。 I サブクラスは Netscape と互換性のある フォーマットで保存するために使われます。 =item $cookie_jar->load =item $cookie_jar->load( $file ) =begin original This method reads the cookies from the file and adds them to the $cookie_jar. The file must be in the format written by the save() method. =end original このメソッドはファイルからクッキーを読みこみ、$cookie_jar に追加します。 ファイルは save() メソッドにより書かれたフォーマットでなければなりません。 =item $cookie_jar->revert =begin original This method empties the $cookie_jar and re-loads the $cookie_jar from the last save file. =end original このメソッドは $cookie_jar を空とし、最後に保存したファイルから $cookie_jar をリロードします。 =item $cookie_jar->clear =item $cookie_jar->clear( $domain ) =item $cookie_jar->clear( $domain, $path ) =item $cookie_jar->clear( $domain, $path, $key ) =begin original Invoking this method without arguments will empty the whole $cookie_jar. If given a single argument only cookies belonging to that domain will be removed. If given two arguments, cookies belonging to the specified path within that domain are removed. If given three arguments, then the cookie with the specified key, path and domain is removed. =end original 引数無しでこのメソッドを呼び出すと $cookie_jar 全体を空にします。 もし一つの引数だけが与えられれば、そのドメインに所属するクッキーだけが 削除されます。 引数が二つ与えられると、指定されたドメインにあるそのパスに所属する クッキーだけが削除されます。 三つの引数が与えられると指定されたキー、パスそしてドメインをもつ クッキーが削除されます。 =item $cookie_jar->clear_temporary_cookies =begin original Discard all temporary cookies. Scans for all cookies in the jar with either no expire field or a true C flag. To be called when the user agent shuts down according to RFC 2965. =end original 全ての一時的クッキーを破棄します。 容器の中から、有効期限フィールドがないか、C フラグが真の クッキーを探します。 RFC 2965 によれば、ユーザーエージェントがシャットダウンするときに 呼び出されます。 =item $cookie_jar->scan( \&callback ) =begin original The argument is a subroutine that will be invoked for each cookie stored in the $cookie_jar. The subroutine will be invoked with the following arguments: =end original 引数はクッキーが $cookie_jar に格納されるたびに呼び出される サブルーチンです。 サブルーチンは以下の引数で呼び出されます: =begin original 0 version 1 key 2 val 3 path 4 domain 5 port 6 path_spec 7 secure 8 expires 9 discard 10 hash =end original 0 バージョン (version) 1 キー (key) 2 値 (val) 3 パス (path) 4 ドメイン (domain) 5 ポート (port) 6 パス指定 (path_spec) 7 セキュリティ (secure) 8 終了 (expires) 9 廃棄 (discard) 10 ハッシュ (hash) =item $cookie_jar->as_string =item $cookie_jar->as_string( $skip_discardables ) =begin original The as_string() method will return the state of the $cookie_jar represented as a sequence of "Set-Cookie3" header lines separated by "\n". If $skip_discardables is TRUE, it will not return lines for cookies with the I attribute. =end original as_string() メソッドは "\n" で区切られた "Set-Cookie3" ヘッダ行の並びで 表された $cookie_jar の状態を返します。 $skip_discard が TRUE であれば、I 属性を持ったクッキーのための行は 返しません。 =back =head1 SEE ALSO L, L =head1 COPYRIGHT Copyright 1997-2002 Gisle Aas This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =begin meta Translated: Hippo2000 (5.48) Updated: Kentaro SHIRAKATA (5.813) =end meta