CGI-Header
view release on metacpan or search on metacpan
1. lowercased
'Content-Length' -> 'content-length'
2. use dashes instead of underscores in property name
'content_length' -> 'content-length'
CGI.pm's "header" method also accepts aliases of property names. This
module converts them as follows:
'content-type' -> 'type'
'cookie' -> 'cookies'
If a property name is duplicated, throws an exception:
my $header = CGI::Header->new(
header => {
-Type => 'text/plain',
Content_Type => 'text/html',
}
);
examples/lib/CGI/Redirect.pm view on Meta::CPAN
sub location {
my $self = shift;
return $self->header->{location} unless @_;
$self->header->{location} = shift;
$self;
}
sub _build_alias {
+{
'content-type' => 'type',
'cookie' => 'cookies',
'uri' => 'location',
'url' => 'location',
};
}
sub finalize {
my $self = shift;
my $query = $self->query;
my $args = $self->header;
examples/lib/CGI/Redirect/Adapter.pm view on Meta::CPAN
sub location {
my $self = shift;
return $self->header->{location} unless @_;
$self->header->{location} = shift;
$self;
}
sub _build_alias {
+{
'content-type' => 'type',
'cookie' => 'cookies',
'uri' => 'location',
'url' => 'location',
};
}
sub as_arrayref {
my $self = shift;
my $clone = $self->clone;
$clone->location( $self->query->self_url ) if !$clone->location;
lib/CGI/Header.pm view on Meta::CPAN
CGI::self_or_default();
}
sub _alias {
my $self = shift;
$self->{alias} ||= $self->_build_alias;
}
sub _build_alias {
+{
'content-type' => 'type',
'cookie' => 'cookies',
};
}
sub _normalize {
my ( $self, $key ) = @_;
my $alias = $self->_alias;
my $prop = lc $key;
$prop =~ s/^-//;
$prop =~ tr/_/-/;
lib/CGI/Header.pm view on Meta::CPAN
=item 2. use dashes instead of underscores in property name
'content_length' -> 'content-length'
=back
CGI.pm's C<header> method also accepts aliases of property names.
This module converts them as follows:
'content-type' -> 'type'
'cookie' -> 'cookies'
If a property name is duplicated, throws an exception:
my $header = CGI::Header->new(
header => {
-Type => 'text/plain',
Content_Type => 'text/html',
}
);
( run in 1.876 second using v1.01-cache-2.11-cpan-524268b4103 )