Revision history for Perl extension CGI::Header.
0.16 Jan 14th, 2013
[INCOMPATIBLE CHANGES]
- 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 CGI.pm-compatible 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"
[INTERNALS]
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
[INTERNALS]
- 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
[INTERNALS]
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"
[BUG FIXES]
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"
[DOCUMENTATION]
Add "Server" and "Date" to "LIMITATIONS"
0.12 Jan 7th, 2013
[INTERNALS]
- Rename _normalize() to _lc()
- Add a benchmark against HTTP::Response->parse
[DOCUMENTATION]
- 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
- CGI.pm 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 CGI.pm.
Namely,
my $h = CGI::Header->new( -type => 'text/plain' );
$h->get( 'Content-Type' ); # => "text/plain; charset=ISO-8859-1"
become
$h->get( 'Content-Type' ); # => "text/plain"
0.08 Nov 13th, 2012
- reimplemented rehash()
- [DOCUMENTATION] add header() to "INSTANCE METHODS"
- [DOCUMENTATION] describe how this module normalizes parameter names
0.07 Nov 12th, 2012
- [DOCUMENTATION] add "tie() INTERFACE"
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
references.
0.03 Oct 7th, 2012
- add a benchmark against HTTP::Parser::XS
- update POD
- add t/server.t
- tests require CGI.pm 3.51 because the distribution contains t/headers.t
0.02 Oct 4th, 2012
- tests require CGI.pm 3.60 and HTTP::Date
- fix typo
0.01 Sep 23rd, 2012
- Forked from Blosxom::Header