Dendral::HTTP::Response - Perl interface for Apache response variables
# Mod_perl handler use Dendral::HTTP::Response; sub handler { my $r = shift; my $res = new Dendral::HTTP::Response($r); #Add cookie to response header $res -> add_cookie(name => 'Cooker', value => {qwe => 'Test',asd => '3'}, domain => 'www.Rambler.ru, path => '/123', secure => 1, expires => '+1M'); #Set response header $res -> set_header('X-Message' => 'Hello'); #Delete Response header by name $res -> delete_header('Set-Cookie'); #Merge header $res -> merge_header('X-Temp','123'); #Clear all response header $res -> clear_headers(); #Send response headers (Apache 1.x) $res -> send_http_header(); #Send file to client $res -> send_file('/etc/passwd'); }
Dendral::HTTP::Response is a part of Dendral - fast, reliable and lightweight MVC framework.
Create a new Dendral::HTTP::Response object with an Apache request_rec object: my $res = new Dendral::HTTP::Response($r);
$res -> add_cookie(name => 'Cooker1', value => 123, domain => 'www.rambler.ru, path => '/123'); $res -> add_cookie(name => 'Cooker2', value => {qwe => 'Test',asd => '3'}, domain => 'www.Rambler.ru, path => '/1234', expires => '+1M', secure => 1, httponly => 1);
$res -> set_http_code(404);
my $code = $res -> get_http_code();
$res -> send_http_header();
$res -> redirect('/index.html');
$res -> redirect_permanent('/index.html');
$res -> set_header('X-Message' => 'Hello');
$msg = $res -> get_header('X-Message'); #Get hashref of all Headers $headers = $res -> get_header();
$res -> set_content_type('text/plain');
my $content_type = $res -> get_content_type();
$res -> delete_header('X-Message');
$res -> merge_header('X-Message', 'Test');
$res -> clear_headers();
$res -> send_file('/etc/passwd');
perl(1), Apache(3), Dendral::HTTP::Request(1)
To install Dendral::HTTP::Response, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dendral::HTTP::Response
CPAN shell
perl -MCPAN -e shell install Dendral::HTTP::Response
For more information on module installation, please visit the detailed CPAN module installation guide.