1 package Maypole::Headers;
2 use base 'HTTP::Headers';
7 our $VERSION = "1." . sprintf "%04d", q$Rev$ =~ /: (\d+)/;
17 *add = \&push; # useful for Apache::Session::Wrapper support
20 shift->push_header(@_);
24 shift->init_header(@_);
28 shift->remove_header(@_);
32 shift->header_field_names(@_);
41 Maypole::Headers - Convenience wrapper around HTTP::Headers
47 $r->headers_out(Maypole::Headers->new); # Note, automatic in Maypole
48 $r->headers_out->set('Content-Base' => 'http://localhost/maypole');
49 $r->headers_out->push('Set-Cookie' => $cookie->as_string);
50 $r->headers_out->push('Set-Cookie' => $cookie2->as_string);
52 print $r->headers_out->as_string;
56 A convenience wrapper around C<HTTP::Headers>. Additional methods are provided
57 to make the mutators less repetitive and wordy. For example:
59 $r->headers_out->header(Content_Base => $r->config->uri_base);
63 $r->headers_out->set(Content_Base => $r->config->uri_base);
67 All the standard L<HTTP::Headers> methods, plus the following:
73 Get the value of a header field.
75 An alias to C<HTTP::Headers-E<gt>header>
77 =item set($header =C<gt> $value, ...)
79 Set the value of one or more header fields
81 An alias to C<HTTP::Headers-E<gt>header>
83 =item push($header =C<gt> $value)
85 Add a value to the field named C<$header>. Previous values are maintained.
87 An alias to C<HTTP::Headers-E<gt>push_header>
91 Alias to C<push> - useful for C<Apache::Session::Wrapper> support, in CGI mode.
93 =item init($header =C<gt> $value)
95 Set the value for the field named C<$header>, but only if that header is
98 An alias to C<HTTP::Headers-E<gt>init_header>
100 =item remove($header, ...)
102 Remove one of more headers
104 An alias to C<HTTP::Headers-E<gt>remove_header>
108 Returns a list of distinct header names
110 An alias to C<HTTP::Headers-E<gt>header_field_names>