table of contents
Furl::Headers(3pm) | User Contributed Perl Documentation | Furl::Headers(3pm) |
NAME¶
Furl::Headers - HTTP Headers object
SYNOPSIS¶
CONSTRUCTOR¶
- my $headers = Furl::Headers->new(\%headers);
- The constructor takes one argument. It is a hashref. Every key of hashref
must be lower-cased.
The format of the argument is like following:
+{ 'content-length' => [30], 'set-cookies' => ['auth_token=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT', '_twitter_sess=JKLJBNBLKSFJBLKSJBLKSJLKJFLSDJFjkDKFUFIOSDUFSDVjOTUzNzUwNTE2%250AZWFiMWRiNDZhMDcwOWEwMWQ5IgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVy%250AOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA--d9ce07496a22525bc178jlkhafklsdjflajfl411; domain=.twitter.com; path=/'], }
INSTANCE METHODS¶
- my @values = $headers->header($key);
- Get the header value in array.
- my $values_joined = $headers->header($key);
- Get the header value in scalar. This is not a first value of header. This
is same as:
my $values = join(", ", $headers->header($key))
- $headers->header($key, $val);
- $headers->header($key, \@val);
- Set the new value of headers.
- $headers->remove_header($key);
- Delete key from headers.
- my @h = $headers->flatten();
- Gets pairs of keys and values.
- my @keys = $headers->keys();
- my @keys = $headers->header_field_names();
- Returns keys of headers in array. The return value do not contains duplicated value.
- my $str = $headers->as_string();
- Return the header fields as a formatted MIME header.
- my $val = $headers->referer()
- my $val = $headers->expires()
- my $val = $headers->last_modified()
- my $val = $headers->if_modified_since()
- my $val = $headers->content_type()
- my $val = $headers->content_length()
- my $val = $headers->content_encoding()
- These methods are shortcut for popular headers.
- $headers->clone();
- Returns a copy of this "Furl::Headers" object.
SEE ALSO¶
HTTP::Headers
2021-05-14 | perl v5.40.0 |