=encoding euc-jp =head1 NAME =begin original HTTP::Message - HTTP style message (base class) =end original HTTP::Message - HTTP 形式のメッセージ (基底クラス) =head1 SYNOPSIS use base 'HTTP::Message'; =head1 DESCRIPTION =begin original An C object contains some headers and a content body. The following methods are available: =end original C オブジェクトには幾つかのヘッダとコンテンツの本体が 入っています。 以下のメソッドが利用できます: =over 4 =item $mess = HTTP::Message->new =item $mess = HTTP::Message->new( $headers ) =item $mess = HTTP::Message->new( $headers, $content ) =begin original This constructs a new message object. Normally you would want construct C or C objects instead. =end original これは新しいメッセージオブジェクトを構築します。 普通は代わりに C または C オブジェクトを 構築したいでしょう。 =begin original The optional $header argument should be a reference to an C object or a plain array reference of key/value pairs. If an C object is provided then a copy of it will be embedded into the constructed message, i.e. it will not be owned and can be modified afterwards without affecting the message. =end original オプションの $header 引数は C オブジェクトへのリファレンスか、 キー/値の組へのリファレンスの配列を取ります。 C オブジェクトを指定した場合は、これのコピーが 構築されるメッセージに組み込まれます (つまり、後でオブジェクトを変更しても メッセージには影響を与えません)。 =begin original The optional $content argument should be a string of bytes. =end original オプションの $content 引数はバイト文字列であるべきです。 =item $mess = HTTP::Message->parse( $str ) =begin original This constructs a new message object by parsing the given string. =end original 与えられた文字列をパースすることで新しいメッセージオブジェクトを 作成します。 =item $mess->headers =begin original Returns the embedded C object. =end original 埋め込まれた C オブジェクトを返します。 =item $mess->headers_as_string =item $mess->headers_as_string( $eol ) =begin original Call the as_string() method for the headers in the message. This will be the same as =end original メッセージの中のヘッダのために as_string() を呼び出します。 これは以下のものと同様ですが $mess->headers->as_string =begin original but it will make your program a whole character shorter :-) =end original あなたのプログラムの文字数が減ります :-) =item $mess->content =item $mess->content( $bytes ) =begin original The content() method sets the raw content if an argument is given. If no argument is given the content is not touched. In either case the original raw content is returned. =end original 引数が与えられていれば、content() メソッドは生の内容を設定します。 引数が与えられなければ、内容は触られません。 いずれの場合も元の生の内容は返されます。 =begin original Note that the content should be a string of bytes. Strings in perl can contain characters outside the range of a byte. The C module can be used to turn such strings into a string of bytes. =end original 内容はバイト文字列であるべきであることに注意してください。 Perl での文字列はバイトの範囲を超える文字を含むことができます。 そのような文字列をバイト文字列を変換するには C モジュールが 使えます。 =item $mess->add_content( $bytes ) =begin original The add_content() methods appends more data bytes to the end of the current content buffer. =end original add_content() メソッドは現在のコンテンツの末尾にさらにバイトデータを 追加します。 =item $mess->add_content_utf8( $string ) =begin original The add_content_utf8() method appends the UTF-8 bytes representing the string to the end of the current content buffer. =end original add_content_utf8() メソッドは、$string で表現される UTF-8 バイトを 現在の内容バッファの末尾に追加します。 =item $mess->content_ref =item $mess->content_ref( \$bytes ) =begin original The content_ref() method will return a reference to content buffer string. It can be more efficient to access the content this way if the content is huge, and it can even be used for direct manipulation of the content, for instance: =end original content_ref() メソッドは内容バッファ文字列へのリファレンスを返します。 コンテンツが巨大であれば、この方法でコンテンツにアクセスするのはより 効率的かもしれません。 そしてコンテンツの直接操作するためにすら使うことが出来ます。 例えば: ${$res->content_ref} =~ s/\bfoo\b/bar/g; =begin original This example would modify the content buffer in-place. =end original この例は、内容バッファ自体を変更します。 =begin original If an argument is passed it will setup the content to reference some external source. The content() and add_content() methods will automatically dereference scalar references passed this way. For other references content() will return the reference itself and add_content() will refuse to do anything. =end original 引数が渡されると、それを外部ソースへリファレンスとして内容を 設定します。 content() メソッドと add_content() メソッドは、この方法で渡された スカラリファレンスを自動的にデリファレンスします。 その他のリファレンスの場合、content() はリファレンス自身を返し、 add_content() は何もしません。 =item $mess->decoded_content( %options ) =begin original Returns the content with any C undone and the raw content encoded to perl's Unicode strings. If the C or C of the message is unknown this method will fail by returning C. =end original C が未処理の、perl の Unicode 文字列でエンコードされた 生の内容を返します。 メッセージの C あるいは C が不明の場合、 このメソッドは C を返して失敗します。 =begin original The following options can be specified. =end original 以下のオプションが指定できます。 =over =item C =begin original This override the charset parameter for text content. The value C can used to suppress decoding of the charset. =end original これはテキストの内容の文字集合パラメータを上書きします。 文字セットのデコードを抑制するために C という値が使えます。 =item C =begin original This override the default charset of "ISO-8859-1". =end original これはデフォルトの文字集合である "ISO-8859-1" を上書きします。 =item C =begin original Abort decoding if malformed characters is found in the content. By default you get the substitution character ("\x{FFFD}") in place of malformed characters. =end original もし内容に不正な文字が見つかると、デコードを中断します。 デフォルトでは、不正な文字の位置には代わりの文字 ("\x{FFFD}") が 使われます。 =item C =begin original If TRUE then raise an exception if not able to decode content. Reason might be that the specified C or C is not supported. If this option is FALSE, then decoded_content() will return C on errors, but will still set $@. =end original この値が真の場合、内容をデコードできない場合に例外が発生します。 理由は、C や C に指定されたものに 対応していないことかもしれません。 この値が偽の場合、decoded_content() はエラー時には C を 返しますが、それでも $@ は設定されます。 =item C =begin original If TRUE then a reference to decoded content is returned. This might be more efficient in cases where the decoded content is identical to the raw content as no data copying is required in this case. =end original この値が真の場合、デコードされた内容へのリファレンスが返されます。 元の内容とデコードされた内容が同じ場合、データのコピーが必要ないので、 これを設定するとより効率的になるでしょう。 =back =item $mess->parts =item $mess->parts( @parts ) =item $mess->parts( \@parts ) =begin original Messages can be composite, i.e. contain other messages. The composite messages have a content type of C or C. This method give access to the contained messages. =end original メッセージは合成できます (他のメッセージを含むことができます)。 合成メッセージは C や C のコンテントタイプを 持ちます。 このメソッドは含まれているメッセージにアクセスします。 =begin original The argumentless form will return a list of C objects. If the content type of $msg is not C or C then this will return the empty list. In scalar context only the first object is returned. The returned message parts should be regarded as are read only (future versions of this library might make it possible to modify the parent by modifying the parts). =end original 引数なし形式の場合は C オブジェクトのリストを返します。 $msg のコンテントタイプが C でも C でもない場合は 空リストが返されます。 スカラコンテキストでは最初のオブジェクトのみが返されます。 返されたメッセージ部品は読み込み専用と考えるべきです (このライブラリの将来のバージョンでは、部品を変更することで親を 変更できるようになるかもしれません)。 =begin original If the content type of $msg is C then there will only be one part returned. =end original $msg のコンテントタイプが C なら、一つの部品だけが 返されます。 =begin original If the content type is C, then the return value will be either an C or an C object. =end original コンテントタイプが C なら、返された値は C オブジェクトか C オブジェクトです。 =begin original If an @parts argument is given, then the content of the message will be modified. The array reference form is provided so that an empty list can be provided. The @parts array should contain C objects. The @parts objects are owned by $mess after this call and should not be modified or made part of other messages. =end original @parts 引数が与えられると、メッセージの内容は変更されます。 空リストを提供できるように、配列リファレンス形式で提供されます。 @parts 配列は C オブジェクトを含んでいる必要があります。 @parts オブジェクトはこの呼び出しの後 $mess によって所有され、 修正されたり、他のメッセージの部品となったりはしません。 =begin original When updating the message with this method and the old content type of $mess is not C or C, then the content type is set to C and all other content headers are cleared. =end original このメソッドによってメッセージが更新され、$mess の古い コンテントタイプが C でも C でもない場合、 コンテントタイプは C に設定され、その他の全ての コンテントヘッダはクリアされます。 =begin original This method will croak if the content type is C and more than one part is provided. =end original このメソッドは、コンテントタイプが C で、複数の部品が 提供された場合、croak します。 =item $mess->add_part( $part ) =begin original This will add a part to a message. The $part argument should be another C object. If the previous content type of $mess is not C then the old content (together with all content headers) will be made part #1 and the content type made C before the new part is added. The $part object is owned by $mess after this call and should not be modified or made part of other messages. =end original メッセージに部品を追加します。 $part 引数はもう一つの C オブジェクトです。 $mess の以前のコンテントタイプが C でない場合、 古い内容(と全てのコンテントヘッダ) は 1 番目の部品になり、新しい部品が 追加される前にコンテントタイプは C になります。 $part オブジェクトはこの呼び出しの後 $mess によって所有され、 修正されたり、他のメッセージの部品となったりはしません。 =begin original There is no return value. =end original 返り値はありません。 =item $mess->clear =begin original Will clear the headers and set the content to the empty string. There is no return value =end original ヘッダをクリアし、内容を空文字列に設定します。 返り値はありません。 =item $mess->protocol =item $mess->protocol( $proto ) =begin original Sets the HTTP protocol used for the message. The protocol() is a string like C or C. =end original そのメッセージに使われる HTTP プロトコルを設定します。 protocol() は C や C のような文字列です。 =item $mess->clone =begin original Returns a copy of the message object. =end original メッセージオブジェクトのコピーを返します。 =item $mess->as_string =item $mess->as_string( $eol ) =begin original Returns the message formatted as a single string. =end original 単一の文字列の形でメッセージを返します。 =begin original The optional $eol parameter specifies the line ending sequence to use. The default is "\n". If no $eol is given then as_string will ensure that the returned string is newline terminated (even when the message content is not). No extra newline is appended if an explicit $eol is passed. =end original オプションの $eol 引数は、使用する行末シーケンスを指定します。 デフォルトは "\n" です。 $eol が与えられなかった場合は、(たとえメッセージの末尾に改行がなくても) 返される文字列が改行で終端されることが保証されます。 明示的に $eol が渡された場合は、改行は追加されません。 =back =begin original All methods unknown to C itself are delegated to the C object that is part of every message. This allows convenient access to these methods. Refer to L for details of these methods: =end original C 自身が分からないすべてのメソッドは、 代わりに各メッセージの一部である C オブジェクトに 委譲されます。 これは以下の便利メソッドへのアクセスを可能にします。 これらのメソッドについての詳細は C を参照してください。 $mess->header( $field => $val ) $mess->push_header( $field => $val ) $mess->init_header( $field => $val ) $mess->remove_header( $field ) $mess->remove_content_headers $mess->header_field_names $mess->scan( \&doit ) $mess->date $mess->expires $mess->if_modified_since $mess->if_unmodified_since $mess->last_modified $mess->content_type $mess->content_encoding $mess->content_length $mess->content_language $mess->title $mess->user_agent $mess->server $mess->from $mess->referer $mess->www_authenticate $mess->authorization $mess->proxy_authorization $mess->authorization_basic $mess->proxy_authorization_basic =head1 COPYRIGHT Copyright 1995-2004 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