I think the example in the Dancer::Errror documentation is wrong. The render method will build the reponse for you, so there is no need to use Dancer::Response. Try this: get '/quux' => sub { err_not_found ( '/quux' ) }; sub err_not_found { my $path = shift; my $error = Dancer::Error->new( code => 404, message => "No such file: $path", ); $error->render; } On 23 April 2012 08:01, Joel Roth <joelz@pobox.com> wrote:
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 _______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users