GX::HTTP::Response::Headers

Module Version: 0.2000_01

NAME

GX::HTTP::Response::Headers - HTTP response headers class

SYNOPSIS

# Load the class
use GX::HTTP::Response::Headers;

# Create a new headers object
$headers = GX::HTTP::Response::Headers->new;

# Set the value of a header field
$headers->set( 'Content-Type' => 'text/plain' );

# Get the value of a header field
$content_type = $headers->get( 'Content-Type' );

# Print the headers
print $headers->as_string;

DESCRIPTION

This module provides the GX::HTTP::Response::Headers class which extends the GX::HTTP::Headers class.

METHODS

Constructor

new

Returns a new GX::HTTP::Response::Headers object.

$headers = GX::HTTP::Response::Headers->new;
Returns:
Exceptions:

Also see parse().

Basic Public API

as_string

See GX::HTTP::Headers.

field_names

See GX::HTTP::Headers.

parse

Parses the given message header and adds the resulting header field / value pairs to the container.

$headers->parse( $string );
Arguments:
  • $string ( string )

This method can also be used as a constructor.

$headers = GX::HTTP::Response::Headers->parse( $string );
Arguments:
  • $string ( string )
Returns:
Exceptions:

sorted_field_names

See GX::HTTP::Headers.

Public Field Accessors

content_disposition

See GX::HTTP::Headers.

content_encoding

See GX::HTTP::Headers.

content_language

See GX::HTTP::Headers.

content_length

See GX::HTTP::Headers.

content_type

See GX::HTTP::Headers.

expires

See GX::HTTP::Headers.

last_modified

See GX::HTTP::Headers.

location

Returns / sets the value of the "Location" header field.

$value = $headers->location;
$value = $headers->location( $value );
Arguments:
  • $value ( string | undef ) [ optional ]
Returns:
  • $value ( string | undef )

See RFC 2616, section 14.30.

set_cookie

Returns / sets the value of the "Set-Cookie" header field.

$value = $headers->set_cookie;
$value = $headers->set_cookie( $value );
Arguments:
  • $value ( string | undef ) [ optional ]
Returns:
  • $value ( string | undef )

See RFC 2109, section 4.2.2.

AUTHOR

Jörg A. Uzarek <uzarek@runlevelnull.de>

COPYRIGHT AND LICENSE

Copyright © 2009-2011 Jörg A. Uzarek.

This module is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License Version 3 as published by the Free Software Foundation.