Maypole::Headers(3)

πŸ“¦
version 2.13 Β· 2 versions
, in fedora 43

πŸ’– Maypole::Headers πŸ’–

okay bestie, gather round, because this is the little module that makes your HTTP headers situation so much cuter. it's a convenience wrapper around HTTP::Headers β€” that's the whole vibe. ✨


🌸 NAME 🌸

Maypole::Headers β€” a convenience wrapper around HTTP::Headers. she's small, she's helpful, she's lowkey carrying your whole response. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

use Maypole::Headers;

$r->headers_out(Maypole::Headers->new); # Note, automatic in Maypole
$r->headers_out->set('Content-Base' => 'http://localhost/maypole');
$r->headers_out->push('Set-Cookie' => $cookie->as_string);
$r->headers_out->push('Set-Cookie' => $cookie2->as_string);

print $r->headers_out->as_string;

like. look at her. set, push, as_string, done. no notes. 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

so basically it's a convenience wrapper around HTTP::Headers, but with extra methods sprinkled on top so your mutators stop being so repetitive and wordy. it's giving less typing, same power. ✨

for example, this:

$r->headers_out->header(Content_Base => $r->config->uri_base);

can be written as:

$r->headers_out->set(Content_Base => $r->config->uri_base);

same thing, shorter name, cuter energy. periodt. πŸ’œ


πŸ‘‘ METHODS πŸ‘‘

you get all the standard HTTP::Headers methods, plus these icons right here:

  • get($header) β€” gets the value of a header field. it's an alias to HTTP::Headers->header. πŸ“
  • set($header ="gt" $value, ...) β€” sets the value of one or more header fields. also an alias to HTTP::Headers->header. you can pass a whole little pile of them, hence the .... πŸ’…
  • push($header ="gt" $value) β€” adds a value to the field named $header, and bestie, the previous values are maintained. nothing gets thrown away here. it's an alias to HTTP::Headers->push_header. πŸ”₯
  • add β€” alias to push β€” useful for Apache::Session::Wrapper support, in CGI mode. yeah, that's the whole entry. iconic of her honestly. 🌈
  • init($header ="gt" $value) β€” sets the value for the field named $header, but only if that header is currently undefined. so if it's already set, she minds her business and does nothing. it's an alias to HTTP::Headers->init_header. 🧚
  • remove($header, ...) β€” removes one or more headers. yes plural, go off. it's an alias to HTTP::Headers->remove_header. πŸ’€
  • field_names() β€” returns a list of distinct header names. it's an alias to HTTP::Headers->header_field_names. ⭐

πŸ’œ SEE ALSO πŸ’œ

HTTP::Headers β€” the original queen this whole thing wraps around. go pay her a visit. πŸŽ€


✨ AUTHOR ✨

Simon Flack β€” thank you for your service, king. 🫢


and that's the whole page, bestie!! this was perl v5.42.0, dated 2025-07-25, filed under Maypole::Headers(3) β€” no cap, go forth and set your headers. mwah. πŸ’–βœ¨πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from