| 
									
										
										
										
											2011-03-18 13:24:19 +00:00
										 |  |  | #
 | 
					
						
							| 
									
										
										
										
											2011-04-01 07:53:49 +00:00
										 |  |  | # spec file for package perl-HTTP-Message
 | 
					
						
							| 
									
										
										
										
											2011-03-18 13:24:19 +00:00
										 |  |  | #
 | 
					
						
							| 
									
										
										
										
											2018-01-05 13:31:13 +00:00
										 |  |  | # Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
 | 
					
						
							| 
									
										
										
										
											2011-03-18 13:24:19 +00:00
										 |  |  | #
 | 
					
						
							|  |  |  | # All modifications and additions to the file contributed by third parties
 | 
					
						
							|  |  |  | # remain the property of their copyright owners, unless otherwise agreed
 | 
					
						
							|  |  |  | # upon. The license for this file, and modifications and additions to the
 | 
					
						
							|  |  |  | # file, is the same license as for the pristine package itself (unless the
 | 
					
						
							|  |  |  | # license for the pristine package is not an Open Source License, in which
 | 
					
						
							|  |  |  | # case the license is the MIT License). An "Open Source License" is a
 | 
					
						
							|  |  |  | # license that conforms to the Open Source Definition (Version 1.9)
 | 
					
						
							|  |  |  | # published by the Open Source Initiative.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Please submit bugfixes or comments via http://bugs.opensuse.org/
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-01 07:53:49 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-18 13:24:19 +00:00
										 |  |  | Name:           perl-HTTP-Message
 | 
					
						
							| 
									
										
										
										
											2018-03-14 14:55:24 +00:00
										 |  |  | Version:        6.15
 | 
					
						
							| 
									
										
										
										
											2013-04-15 11:16:44 +00:00
										 |  |  | Release:        0
 | 
					
						
							| 
									
										
										
										
											2011-04-01 07:53:36 +00:00
										 |  |  | %define cpan_name HTTP-Message
 | 
					
						
							|  |  |  | Summary:        HTTP style message (base class)
 | 
					
						
							| 
									
										
										
										
											2018-03-14 14:55:24 +00:00
										 |  |  | License:        Artistic-1.0 OR GPL-1.0-or-later
 | 
					
						
							| 
									
										
										
										
											2011-04-01 07:53:36 +00:00
										 |  |  | Group:          Development/Libraries/Perl
 | 
					
						
							| 
									
										
										
										
											2013-04-15 11:16:44 +00:00
										 |  |  | Url:            http://search.cpan.org/dist/HTTP-Message/
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | Source0:        https://cpan.metacpan.org/authors/id/O/OA/OALDERS/%{cpan_name}-%{version}.tar.gz
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | Source1:        cpanspec.yml
 | 
					
						
							| 
									
										
										
										
											2011-03-18 13:24:19 +00:00
										 |  |  | BuildArch:      noarch
 | 
					
						
							|  |  |  | BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 | 
					
						
							|  |  |  | BuildRequires:  perl
 | 
					
						
							|  |  |  | BuildRequires:  perl-macros
 | 
					
						
							| 
									
										
										
										
											2013-08-05 09:04:35 +00:00
										 |  |  | BuildRequires:  perl(Compress::Raw::Zlib)
 | 
					
						
							|  |  |  | BuildRequires:  perl(Encode) >= 2.21
 | 
					
						
							| 
									
										
										
										
											2011-03-18 13:24:19 +00:00
										 |  |  | BuildRequires:  perl(Encode::Locale) >= 1
 | 
					
						
							|  |  |  | BuildRequires:  perl(HTTP::Date) >= 6
 | 
					
						
							| 
									
										
										
										
											2013-08-05 09:04:35 +00:00
										 |  |  | BuildRequires:  perl(IO::Compress::Bzip2) >= 2.021
 | 
					
						
							|  |  |  | BuildRequires:  perl(IO::Compress::Deflate)
 | 
					
						
							|  |  |  | BuildRequires:  perl(IO::Compress::Gzip)
 | 
					
						
							|  |  |  | BuildRequires:  perl(IO::HTML)
 | 
					
						
							|  |  |  | BuildRequires:  perl(IO::Uncompress::Bunzip2) >= 2.021
 | 
					
						
							|  |  |  | BuildRequires:  perl(IO::Uncompress::Gunzip)
 | 
					
						
							|  |  |  | BuildRequires:  perl(IO::Uncompress::Inflate)
 | 
					
						
							|  |  |  | BuildRequires:  perl(IO::Uncompress::RawInflate)
 | 
					
						
							| 
									
										
										
										
											2011-03-18 13:24:19 +00:00
										 |  |  | BuildRequires:  perl(LWP::MediaTypes) >= 6
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | BuildRequires:  perl(Test::More) >= 0.88
 | 
					
						
							|  |  |  | BuildRequires:  perl(Try::Tiny)
 | 
					
						
							| 
									
										
										
										
											2011-03-18 13:24:19 +00:00
										 |  |  | BuildRequires:  perl(URI) >= 1.10
 | 
					
						
							| 
									
										
										
										
											2013-08-05 09:04:35 +00:00
										 |  |  | Requires:       perl(Compress::Raw::Zlib)
 | 
					
						
							|  |  |  | Requires:       perl(Encode) >= 2.21
 | 
					
						
							| 
									
										
										
										
											2011-03-18 13:24:19 +00:00
										 |  |  | Requires:       perl(Encode::Locale) >= 1
 | 
					
						
							|  |  |  | Requires:       perl(HTTP::Date) >= 6
 | 
					
						
							| 
									
										
										
										
											2013-08-05 09:04:35 +00:00
										 |  |  | Requires:       perl(IO::Compress::Bzip2) >= 2.021
 | 
					
						
							|  |  |  | Requires:       perl(IO::Compress::Deflate)
 | 
					
						
							|  |  |  | Requires:       perl(IO::Compress::Gzip)
 | 
					
						
							|  |  |  | Requires:       perl(IO::HTML)
 | 
					
						
							|  |  |  | Requires:       perl(IO::Uncompress::Bunzip2) >= 2.021
 | 
					
						
							|  |  |  | Requires:       perl(IO::Uncompress::Gunzip)
 | 
					
						
							|  |  |  | Requires:       perl(IO::Uncompress::Inflate)
 | 
					
						
							|  |  |  | Requires:       perl(IO::Uncompress::RawInflate)
 | 
					
						
							| 
									
										
										
										
											2011-03-18 13:24:19 +00:00
										 |  |  | Requires:       perl(LWP::MediaTypes) >= 6
 | 
					
						
							|  |  |  | Requires:       perl(URI) >= 1.10
 | 
					
						
							|  |  |  | %{perl_requires}
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | %description
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | An 'HTTP::Message' object contains some headers and a content body. The
 | 
					
						
							|  |  |  | following methods are available:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | * $mess = HTTP::Message->new
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | * $mess = HTTP::Message->new( $headers )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | * $mess = HTTP::Message->new( $headers, $content )
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | This constructs a new message object. Normally you would want construct
 | 
					
						
							|  |  |  | 'HTTP::Request' or 'HTTP::Response' objects instead.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | The optional $header argument should be a reference to an 'HTTP::Headers'
 | 
					
						
							|  |  |  | object or a plain array reference of key/value pairs. If an 'HTTP::Headers'
 | 
					
						
							|  |  |  | 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.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | The optional $content argument should be a string of bytes.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | * $mess = HTTP::Message->parse( $str )
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | This constructs a new message object by parsing the given string.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | * $mess->headers
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | Returns the embedded 'HTTP::Headers' object.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | * $mess->headers_as_string
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | * $mess->headers_as_string( $eol )
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | Call the as_string() method for the headers in the message. This will be
 | 
					
						
							|  |  |  | the same as
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  |     $mess->headers->as_string
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | but it will make your program a whole character shorter :-)
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | * $mess->content
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | * $mess->content( $bytes )
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | 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.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | If the 'undef' argument is given, the content is reset to its default
 | 
					
						
							|  |  |  | value, which is an empty string.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Note that the content should be a string of bytes. Strings in perl can
 | 
					
						
							|  |  |  | contain characters outside the range of a byte. The 'Encode' module can be
 | 
					
						
							|  |  |  | used to turn such strings into a string of bytes.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | * $mess->add_content( $bytes )
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | The add_content() methods appends more data bytes to the end of the current
 | 
					
						
							|  |  |  | content buffer.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | * $mess->add_content_utf8( $string )
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | The add_content_utf8() method appends the UTF-8 bytes representing the
 | 
					
						
							|  |  |  | string to the end of the current content buffer.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | * $mess->content_ref
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | * $mess->content_ref( \$bytes )
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | 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:
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  |   ${$res->content_ref} =~ s/\bfoo\b/bar/g;
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | This example would modify the content buffer in-place.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | 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.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | * $mess->content_charset
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | This returns the charset used by the content in the message. The charset is
 | 
					
						
							|  |  |  | either found as the charset attribute of the 'Content-Type' header or by
 | 
					
						
							|  |  |  | guessing.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | See http://www.w3.org/TR/REC-html40/charset.html#spec-char-encoding for
 | 
					
						
							|  |  |  | details about how charset is determined.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | * $mess->decoded_content( %options )
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | Returns the content with any 'Content-Encoding' undone and for textual
 | 
					
						
							|  |  |  | content the raw content encoded to Perl's Unicode strings. If the
 | 
					
						
							|  |  |  | 'Content-Encoding' or 'charset' of the message is unknown this method will
 | 
					
						
							|  |  |  | fail by returning 'undef'.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | The following options can be specified.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   * 'charset'
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | This override the charset parameter for text content. The value 'none' can
 | 
					
						
							|  |  |  | used to suppress decoding of the charset.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   * 'default_charset'
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | This override the default charset guessed by content_charset() or if that
 | 
					
						
							|  |  |  | fails "ISO-8859-1".
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   * 'alt_charset'
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | If decoding fails because the charset specified in the Content-Type header
 | 
					
						
							|  |  |  | isn't recognized by Perl's Encode module, then try decoding using this
 | 
					
						
							|  |  |  | charset instead of failing. The 'alt_charset' might be specified as 'none'
 | 
					
						
							|  |  |  | to simply return the string without any decoding of charset as alternative.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   * 'charset_strict'
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | Abort decoding if malformed characters is found in the content. By default
 | 
					
						
							|  |  |  | you get the substitution character ("\x{FFFD}") in place of malformed
 | 
					
						
							|  |  |  | characters.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   * 'raise_error'
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | If TRUE then raise an exception if not able to decode content. Reason might
 | 
					
						
							|  |  |  | be that the specified 'Content-Encoding' or 'charset' is not supported. If
 | 
					
						
							|  |  |  | this option is FALSE, then decoded_content() will return 'undef' on errors,
 | 
					
						
							|  |  |  | but will still set $@.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   * 'ref'
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | 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.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | * $mess->decodable
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | * HTTP::Message::decodable()
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | This returns the encoding identifiers that decoded_content() can process.
 | 
					
						
							|  |  |  | In scalar context returns a comma separated string of identifiers.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | This value is suitable for initializing the 'Accept-Encoding' request
 | 
					
						
							|  |  |  | header field.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | * $mess->decode
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | This method tries to replace the content of the message with the decoded
 | 
					
						
							|  |  |  | version and removes the 'Content-Encoding' header. Returns TRUE if
 | 
					
						
							|  |  |  | successful and FALSE if not.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | If the message does not have a 'Content-Encoding' header this method does
 | 
					
						
							|  |  |  | nothing and returns TRUE.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | Note that the content of the message is still bytes after this method has
 | 
					
						
							|  |  |  | been called and you still need to call decoded_content() if you want to
 | 
					
						
							|  |  |  | process its content as a string.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | * $mess->encode( $encoding, ... )
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | Apply the given encodings to the content of the message. Returns TRUE if
 | 
					
						
							|  |  |  | successful. The "identity" (non-)encoding is always supported; other
 | 
					
						
							|  |  |  | currently supported encodings, subject to availability of required
 | 
					
						
							|  |  |  | additional modules, are "gzip", "deflate", "x-bzip2" and "base64".
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | A successful call to this function will set the 'Content-Encoding' header.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | Note that 'multipart/*' or 'message/*' messages can't be encoded and this
 | 
					
						
							|  |  |  | method will croak if you try.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | * $mess->parts
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | * $mess->parts( @parts )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | * $mess->parts( \@parts )
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | Messages can be composite, i.e. contain other messages. The composite
 | 
					
						
							|  |  |  | messages have a content type of 'multipart/*' or 'message/*'. This method
 | 
					
						
							|  |  |  | give access to the contained messages.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | The argumentless form will return a list of 'HTTP::Message' objects. If the
 | 
					
						
							|  |  |  | content type of $msg is not 'multipart/*' or 'message/*' then this will
 | 
					
						
							|  |  |  | return the empty list. In scalar context only the first object is returned.
 | 
					
						
							|  |  |  | The returned message parts should be regarded as read-only (future versions
 | 
					
						
							|  |  |  | of this library might make it possible to modify the parent by modifying
 | 
					
						
							|  |  |  | the parts).
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | If the content type of $msg is 'message/*' then there will only be one part
 | 
					
						
							|  |  |  | returned.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | If the content type is 'message/http', then the return value will be either
 | 
					
						
							|  |  |  | an 'HTTP::Request' or an 'HTTP::Response' object.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | If a @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 'HTTP::Message' objects. The
 | 
					
						
							|  |  |  | @parts objects are owned by $mess after this call and should not be
 | 
					
						
							|  |  |  | modified or made part of other messages.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | When updating the message with this method and the old content type of
 | 
					
						
							|  |  |  | $mess is not 'multipart/*' or 'message/*', then the content type is set to
 | 
					
						
							|  |  |  | 'multipart/mixed' and all other content headers are cleared.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | This method will croak if the content type is 'message/*' and more than one
 | 
					
						
							|  |  |  | part is provided.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | * $mess->add_part( $part )
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | This will add a part to a message. The $part argument should be another
 | 
					
						
							|  |  |  | 'HTTP::Message' object. If the previous content type of $mess is not
 | 
					
						
							|  |  |  | 'multipart/*' then the old content (together with all content headers) will
 | 
					
						
							|  |  |  | be made part #1 and the content type made 'multipart/mixed' 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.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | There is no return value.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | * $mess->clear
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | Will clear the headers and set the content to the empty string. There is no
 | 
					
						
							|  |  |  | return value
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | * $mess->protocol
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | * $mess->protocol( $proto )
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | Sets the HTTP protocol used for the message. The protocol() is a string
 | 
					
						
							|  |  |  | like 'HTTP/1.0' or 'HTTP/1.1'.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | * $mess->clone
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | Returns a copy of the message object.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | * $mess->as_string
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | * $mess->as_string( $eol )
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | Returns the message formatted as a single string.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | 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.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | * $mess->dump( %opt )
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | Returns the message formatted as a string. In void context print the
 | 
					
						
							|  |  |  | string.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | This differs from '$mess->as_string' in that it escapes the bytes of the
 | 
					
						
							|  |  |  | content so that it's safe to print them and it limits how much content to
 | 
					
						
							|  |  |  | print. The escapes syntax used is the same as for Perl's double quoted
 | 
					
						
							|  |  |  | strings. If there is no content the string "(no content)" is shown in its
 | 
					
						
							|  |  |  | place.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | Options to influence the output can be passed as key/value pairs. The
 | 
					
						
							|  |  |  | following options are recognized:
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   * maxlength => $num
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | How much of the content to show. The default is 512. Set this to 0 for
 | 
					
						
							|  |  |  | unlimited.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | If the content is longer then the string is chopped at the limit and the
 | 
					
						
							|  |  |  | string "...\n(### more bytes not shown)" appended.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   * no_content => $str
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | Replaces the "(no content)" marker.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   * prefix => $str
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | A string that will be prefixed to each line of the dump.
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | All methods unknown to 'HTTP::Message' itself are delegated to the
 | 
					
						
							|  |  |  | 'HTTP::Headers' object that is part of every message. This allows
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | convenient access to these methods. Refer to HTTP::Headers for details of
 | 
					
						
							|  |  |  | these methods:
 | 
					
						
							| 
									
										
										
										
											2015-07-13 10:22:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     $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
 | 
					
						
							| 
									
										
										
										
											2011-04-01 07:53:36 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-18 13:24:19 +00:00
										 |  |  | %prep
 | 
					
						
							|  |  |  | %setup -q -n %{cpan_name}-%{version}
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | %build
 | 
					
						
							|  |  |  | %{__perl} Makefile.PL INSTALLDIRS=vendor
 | 
					
						
							|  |  |  | %{__make} %{?_smp_mflags}
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | %check
 | 
					
						
							|  |  |  | %{__make} test
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | %install
 | 
					
						
							|  |  |  | %perl_make_install
 | 
					
						
							|  |  |  | %perl_process_packlist
 | 
					
						
							|  |  |  | %perl_gen_filelist
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | %files -f %{name}.files
 | 
					
						
							| 
									
										
										
										
											2013-08-05 09:04:35 +00:00
										 |  |  | %defattr(-,root,root,755)
 | 
					
						
							| 
									
										
										
										
											2017-06-25 06:40:08 +00:00
										 |  |  | %doc Changes CONTRIBUTORS README.md
 | 
					
						
							|  |  |  | %license LICENSE
 | 
					
						
							| 
									
										
										
										
											2011-03-18 13:24:19 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | %changelog
 |