1 package Maypole::Headers;
2 use base 'HTTP::Headers';
7 our $VERSION = "1." . sprintf "%04d", q$Rev$ =~ /: (\d+)/;
18 shift->push_header(@_);
22 shift->init_header(@_);
26 shift->remove_header(@_);
30 shift->header_field_names(@_);
39 Maypole::Headers - Convenience wrapper around HTTP::Headers
45 $r->headers_out(Maypole::Headers->new); # Note, automatic in Maypole
46 $r->headers_out->set('Content-Base' => 'http://localhost/maypole');
47 $r->headers_out->push('Set-Cookie' => $cookie->as_string);
48 $r->headers_out->push('Set-Cookie' => $cookie2->as_string);
50 print $r->headers_out->as_string;
54 A convenience wrapper around C<HTTP::Headers>. Additional methods are provided
55 to make the mutators less repetitive and wordy. For example:
57 $r->headers->header(Content_Base => $r->config->uri_base);
61 $r->headers->set(Content_Base => $r->config->uri_base);
65 All the standard L<HTTP::Headers> methods, plus the following:
71 Get the value of a header field.
73 An alias to C<HTTP::Headers-E<gt>header>
75 =item set($header =C<gt> $value, ...)
77 Set the value of one or more header fields
79 An alias to C<HTTP::Headers-E<gt>header>
81 =item push($header =C<gt> $value)
83 Add a value to the field named C<$header>. Previous values are maintained.
85 An alias to C<HTTP::Headers-E<gt>push_header>
87 =item init($header =C<gt> $value)
89 Set the value for the field named C<$header>, but only if that header is
92 An alias to C<HTTP::Headers-E<gt>init_header>
94 =item remove($header, ...)
96 Remove one of more headers
98 An alias to C<HTTP::Headers-E<gt>remove_header>
102 Returns a list of distinct header names
104 An alias to C<HTTP::Headers-E<gt>header_field_names>