NAME

PEF::Front::Headers - Base headers class

PEF::Front::HTTPHeaders - Class encapsulating HTTP Message headers

SYNOPSIS

my $basic = $context->{headers}->get_header('basic');

DESCRIPTION

Usually you can get instance of these classes from context: $headers has type PEF::Front::HTTPHeaders. These are also used in PEF::Front::Response for cookies and headers.

The only difference between PEF::Front::Headers and PEF::Front::HTTPHeaders is that HTTPHeaders can convert "CONTENT-TYPE" or "content_type" type of header names to canonical "Content-Type".

FUNCTIONS

new

Constructor. Can set headers and copy from existing PEF::Front::Headers or derived instances.

my $h = PEF::Front::Headers->new($header => $value);
my $h2 = PEF::Front::Headers->new($header1 => $value1, $header2 => $value2, ...);
my $h3 = PEF::Front::Headers->new($h, $h2);

add_header($key, $value)

Adds header. This method allows to have multiple headers with the same name.

set_header($key, $value)

Sets header. This method ensures that there's only one header with given name in response.

remove_header($key)

Removes header.

get_header($key)

Returns header. In case of multiple headers with the same name it returns array of them.

AUTHOR

This module was written and is maintained by Anton Petrusevich.

Copyright and License

Copyright (c) 2016 Anton Petrusevich. Some Rights Reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.