[cgiapp] Re lease CGI::Application::Plugin::Header
Ryo Anazawa
anazawa at kuc.biglobe.ne.jp
Mon Mar 25 14:55:34 EDT 2013
Hi all,
Thanks for maintaining CGI::Application.
I'll release yet another CGI::Application plugin,
CGI::Application::Plugin::Header, on CPAN soon.
This plugin adds the header() method to your CGI app which helps you handle
CGI.pm-comptible HTTP header properties.
Since header() is compatible with the existing handlers such as header_type,
header_props, header_add,
it will not break your application.
You can use header() as follows:
package MyApp;
use parent 'CGI::Application';
use CGI::Application::Plugin::Header 'header';
sub do_something {
my $self = shift;
my $type = $self->header('-type'); # getter
# setter
$self->header(
-charset => 'utf-8',
-type => 'text/plain,
);
my $header = $self->header; # returns CGI::Header::Props object
}
FEATURE
- You can pass key-value pairs of header props. to header().
Unlike header_props(), header() *merges* the pairs into the existing
header props.
- CGI::Header::Props implements push_cookie() and push_p3p() methods. These
methods behave like CGI::Application#header_add.
- Normalizes property names automatically ("-Content_Type" -> "-type"), and
so you can specify them consistently.
CAP::Header is still in development. You can download the latest code in the
following repository:
https://github.com/anazawa/p5-CGI-Header-Props
I'm waiting for your suggestions. Patches are welcome :)
Thanks,
Ryo
--
View this message in context: http://old.nabble.com/Release-CGI%3A%3AApplication%3A%3APlugin%3A%3AHeader-tp35216388p35216388.html
Sent from the cgiapp at lists.openlib.org mailing list archive at Nabble.com.
More information about the cgiapp
mailing list