Search code examples
perlhttpresponseperl-module

Perl module to handle request response


What is the best Perl module to be used in OO style to manage sending response to the client browser with headers, cookies, response codes, redirects. Should be standalone module not part of a framework, I use Moose and CGI::Simple only.

I know I can manually send headers and cookies but I want more control with easy interface.

print "Set-Cookie: $n=$v;$expires;path=/\n";

print "Content-type: text/html;charset=utf-8\n\n";

Interface should be like:

$response->set_header(...);
$response->set_cookie(...);
$response->set_code(404);
$response->redirect(url);
$response->content(...);

I searched cpan.org about response and http keywords but did not get helpful results.


Solution

  • You may use the most common HTTP::Response.