Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 181 lines (131 sloc) 5.602 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
Revision history for Perl extension CGI::Header.

0.17 Jan 18th, 2013

  [DOCUMENTATION]

    - Add "EXAMPLES" and "DEPENDENCIES"

  [INTERNALS]

    - Fix META.yml ("version" was broken)

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
Something went wrong with that request. Please try again.