NAME
Mojo::Message - HTTP Message Base Class
SYNOPSIS
use base 'Mojo::Message';
DESCRIPTION
Mojo::Message is a generic base class for HTTP messages.
ATTRIBUTES
Mojo::Message inherits all attributes from Mojo::Stateful and implements the following new ones.
body_length
my $body_length = $message->body_length;
buffer
my $buffer = $message->buffer;
$message = $message->buffer(Mojo::Buffer->new);
content
my $content = $message->content;
$message = $message->content(Mojo::Content->new);
header_length
my $header_length = $message->header_length;
headers
my $headers = $message->headers;
$message = $message->headers(Mojo::Headers->new);
major_version
my $major_version = $message->major_version;
$message = $message->major_version(1);
minor_version
my $minor_version = $message->minor_version;
$message = $message->minor_version(1);
raw_body_length
my $raw_body_length = $message->raw_body_length;
start_line_length
my $start_line_length = $message->start_line_length;
version
my $version = $message->version;
$message = $message->version('1.1');
METHODS
Mojo::Message inherits all methods from Mojo::Stateful and implements the following new ones.
as_string
my $string = $message->as_string;
body
my $string = $message->body;
$message = $message->body('Hello!');
$counter = 1;
$message = $message->body(sub {
my $self = shift;
my $chunk = '';
$chunk = "hello world!" if $counter == 1;
$chunk = "hello world2!\n\n" if $counter == 2;
$counter++;
return $chunk;
});
build
my $string = $message->build;
build_body
my $string = $message->build_body;
build_headers
my $string = $message->build_headers;
build_start_line
my $string = $message->build_start_line;
fix_headers
$message = $message->fix_headers;
get_body_chunk
my $string = $message->get_body_chunk($offset);
get_header_chunk
my $string = $message->get_header_chunk($offset);
get_start_line_chunk
my $string = $message->get_start_line_chunk($offset);
is_chunked
my $is_chunked = $message->is_chunked;
my $is_multipart = $message->is_multipart;
is_version
my $is_version = $message->is_version('1.1);
parse
$message = $message->parse('HTTP/1.1 200 OK...');
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 407:
Unknown directive: =header2