[Catalyst] handler sub required
Alain Wan
alain.wan at gmail.com
Sat Jul 23 01:52:07 GMT 2011
Hello,
I am having an issue with Catalyst::Controller::REST, which I am trying to
use with mod_perl2 on apache2. For some reason in my handler, I need to
define a handler sub, in which case "hello world" does get returned:
sub handler{
my $r =3D shift;
$r->content_type('text/plain');
print "hello world\n";
return Apache2::Const::OK;
}
Otherwise, modperl2 complains that the handler method is missing.
My settings in apache2 conf are as follows:
PerlModule app
<Location /loc>
SetHandler perl-script
PerlResponseHandler app
</Location>
The code is as follows:
app.pm:
package app;
use Apache2::RequestRec ();
use Apache2::RequestIO ();
use Apache2::Const -compile =3D> qw(OK);
use Moose;
use namespace::autoclean;
BEGIN { extends 'Catalyst::Controller::REST' }
sub hello :Local :ActionClass('REST') {
print "handler entered\n";
}
sub hello_GET {
my ( $self, $c ) =3D @_;
$self->status_ok(
$c,
entity =3D> {
some =3D> 'data',
foo =3D> 'is real bar-y',
},
);
}
1;
Thanks in advance for the help!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20110722/b7e59=
576/attachment.htm
More information about the Catalyst
mailing list