Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
316 lines (212 sloc) 9.05 KB
Revision history for Perl extension CGI::Header.
0.31 Mar 8th, 2013
- add get_alias() which returns the alias of the given property name:
my $alias = CGI::Header->get_alias('content_type'); # => 'type'
0.30 Mar 4th, 2013
- The following operators are overloaded:
"" -> as_string
bool -> SCALAR
- env() is obsolete and will be removed in 0.31.
Summary: env() was replaced with query()
- Add query() method which returns your query object.
You can't pass your current environment (\%ENV) to new() anymore.
my $header = { -type => 'text/plain' };
my $h = CGI::Header->new( $header, \%ENV );
use CGI;
my $query = CGI->new;
my $h = CGI::Header->new( $header, $query );
query() defaults to $CGI::Q. Functions exported by
depends on this query object. In other words, when you choose
the procedural interface of, the module behaves like
a Singleton class.
# $query can be omitted when you choose the procedural
# interface of
my $h = CGI::Header->new( $header );
- as_string() become a shortcut for:
$h->query->header( $h->header )
and so you can't pass $eol to as_string() anymore.
CGI::Header is not compatible with CGI::Simple at this time.
This module will be adapted to CGI::Simple gradually.
(no_cache() isn't supported by, for example)
0.22 Feb 26th, 2013
This distribution doesn't contain CGI::Header::PSGI anymore,
which was separated into another distribution, CGI-Header-PSGI.
The following files were removed:
- lib/CGI/Header/
- t/31_psgi_header.t
- t/40_psgi_header.t
- t/41_psgi_redirect.t
This distribution doesn't require the following modules anymore:
- Exporter
- CGI::PSGI (for testing)
There are no code changes besides incrementing the version number
since CGI-Header-0.21.
0.21 Feb 25th, 2013
- psgi_header() is compatible with CGI::Simple's header() method.
Namely, psgi_header() can be configured by no_cache() method.
If no_cache() isn't available, that method will be ignored simply.
And so psgi_header() is compatible with as well.
- I'm not sure about whether to use Role::Tiny ;)
- [BUG FIX] psgi_redirect() invokes self_url(), not url()
- Imports CGI::PSGI's psgi_headers.t and redirect.t
0.20 Feb 24th, 2013
0.19 Feb 11th, 2013
Add CGI::Header::PSGI which exports two methods on demand: psgi_header()
and psgi_redirect().
use parent 'CGI';
use CGI::Header::PSGI qw(psgi_header psgi_redirect);
CGI::Header::PSGI helps you create your own CGI::PSGI-compatible class.
- rehash() and new() rename '-uri' and '-url' to '-location'
- flatten() and each() stringify CGI::Cookie objects by default.
0.18 Feb 9th, 2013
- You can pass a media type to new() in the following situation:
my $h = CGI::Header->new('text/plain');
$h->header; # => { -type => 'text/plain' }
- new() throws an exception in the following situation:
my $h = CGI::Header->new( -foo => 'bar', '-baz' );
# die "Odd number of elements in hash assignment"
The following methods are unstable:
- $h->set( 'Content-Type => $value )
- $h->set( 'P3P' => $value )
- $h->set( 'Expires' => $value )
I'm not sure about how to process these headers properly at this time.
0.17 Jan 18th, 2013
- Fix META.yml ("version" was broken)
0.16 Jan 14th, 2013
- rehash() throws an exception when a property name is duplicated:
my $header = {
-Type => 'text/plain',
Content_Type => 'text/html',
my $h = CGI::Header->new( $header );
$h->rehash; # die "Property '-type' already exists"
If it was allowed to overwrite existent properties,
it would be essentially impossible to predict
the overwritten value of '-type' in the above example:
$h->header->{-type}; # => 'text/html' or 'text/plain' ?
- In addition to HTTP header properties,
new() accepts '-env' property which represents your current environment:
my $h = CGI::Header->new(
-type => 'text/plain',
-env => \%ENV,
$h->header; # => { -type => 'text/plain' }
$h->env; # => \%ENV
Unlike the above case, if a property name is duplicated,
that property will be overwritten silently:
my $h = CGI::Header->new(
-Type => 'text/plain',
Content_Type => 'text/html',
$h->header->{-type}; # => "text/html"
Add a subtest called 'as_string()' to t/10_basic.t
0.15 Jan 11th, 2013
Add env() which defaults to \%ENV. new() receives an additional
argument which determines the value of the attribute.
my $header = CGI::Header->new({ -type => 'text/plain' }, \%ENV);
$header->env; # => \%ENV
- Add psgi_headers.t which requires CGI::PSGI
- new() returns an object based on a blessed hash.
0.14 Jan 9th, 2013
- set() and delete() throw exceptions when the specified header field
is read-only.
- get() returns undef in the following situations:
$header->header; # => { -expires => q{}, ... }
$header->get( 'Expires' ); # => undef
$header->header; # => { -p3p => q{}, ... }
$header->get( 'P3P' ); # => undef
id() is aliased to Scalar::Util::refaddr()
0.13 Jan 8th, 2013
- clear() and each() return the current object itself
- set() returns the given value:
$header->set( 'Foo' => 'bar' ); # => "bar"
Correct the following warning message:
"Can't set '-content_type' to neither undef nor an empty string"
This message was replaced with:
"Can set '-content_type' to neither undef nor an empty string"
Add "Server" and "Date" to "LIMITATIONS"
0.12 Jan 7th, 2013
- Rename _normalize() to _lc()
- Add a benchmark against HTTP::Response->parse
- Add HTTP::Headers to "SEE ALSO"
0.11 Dec 16th, 2012
- Add FIRSTKEY() and NEXTKEY(). These methods were implemented to
test this module itself.
- flatten() receives optional $is_recursive argument
which determines whether to flatten the Set-Cookie headers recursively.
$is_recursive defaults to true.
- flatten() and each() don't stringify CGI::Cookie objects.
- field_names() returns a list of field names in a random order
0.10 Dec 14th, 2012
- p3p_tags() returns the number of P3P tags
instead of the first element in scalar context
- rehash() returns the current object itself:
my @headers = CGI::Header->new(@args)->rehash->flatten;
- each() doesn't depend on field_names().
field_names() depends on each().
As a result, if Set-Cookie header is multi-valued,
field_names() will return a list which contains duplicate values.
I don't know how to solve this problem at this time.
0.09 Nov 13th, 2012
- has charset() attribute which defaults to 'ISO-8859-1'.
CGI::header() function depends on this attribute.
I noticed this module depends on the default value, 'ISO-8859-1',
and so decided to remove this dependency because this module
shouldn't depend on the internal state of
my $h = CGI::Header->new( -type => 'text/plain' );
$h->get( 'Content-Type' ); # => "text/plain; charset=ISO-8859-1"
$h->get( 'Content-Type' ); # => "text/plain"
0.08 Nov 13th, 2012
- reimplemented rehash()
- [DOCUMENTATION] describe how this module normalizes parameter names
0.07 Nov 12th, 2012
0.06 Nov 11th, 2012
- First release
0.05 Nov 10th, 2012
- add rehash() method which rebuilds header hash references
0.04 Nov 7th, 2012
- reorganized tests using subtest() function exported by Test::More
- doesn't overload '""' (stringify) with as_string()
because this module isn't the replacement of CGI::header() function.
I think CGI::header() should be used to stringify
header hash references in most cases.
- each() doesn't stringify values (cf. HTTP::Headers->scan),
and so the callback function will receive raw CGI::Cookie objects.
- On the other hand, flatten() forces stringification.
flatten() may be called to generate PSGI-compatible header array
0.03 Oct 7th, 2012
- add a benchmark against HTTP::Parser::XS
- update POD
- add t/server.t
- tests require 3.51 because the distribution contains t/headers.t
0.02 Oct 4th, 2012
- tests require 3.60 and HTTP::Date
- fix typo
0.01 Sep 23rd, 2012
- Forked from Blosxom::Header
Jump to Line
Something went wrong with that request. Please try again.