[Dancer-users] Error handling
Joel Roth
joelz at pobox.com
Mon Apr 23 09:01:21 CEST 2012
Can someone help me find an example of how to use Dancer::Error
and Dancer::Response.
This code (based on man Dancer::Error) gets runtime error
"can't find object method set via package Dancer::Response"
------- code ---
get 'quux' => sub { err_not_found ( 'quux' ) };
sub err_not_found {
my $path = shift;
my $error = Dancer::Error->new(
code => 404,
content => "No such file: $path",
);
Dancer::Response->set($error->render);
}
----------------
Thanks,
Joel
--
Joel Roth
More information about the Dancer-users
mailing list