Apache2-REST
view release on metacpan or search on metacpan
lib/Apache2/REST/Handler.pm view on Meta::CPAN
Apache2::REST::Handler - Base class for a resource handler.
=head1 SYNOPSIS
A Handler object is build for each fragment of the URI, and objects are chained via the attibute parent.
You _must_ implement at list one Handler class to handle the root URI of your application and set it in your
apache conf by : PerlSetVar Apache2RESTHandlerRootClass "MyApp::REST::API" (for instance).
You _must_ implement at least one HTTP method (GET,POST,PUT,DELETE ...).
They will be called by the framework like this (for instance):
$this->GET($request,$response) ;
$request is an Apache2::REST::Request (which is a subclass of Apache2::Request).
$response is an Apache2::REST::Response
Each method must return a valid Apache2::Const::HTTP_* code.
lib/Apache2/REST/Handler.pm view on Meta::CPAN
}
if ( $self->isTopLevel()){ return undef ;}
return $self->parent()->seekByClass($className) ;
}
1 ;
#GET
#POST
#PUT
#DELETE
#new
lib/Apache2/REST/Handler/test.pm view on Meta::CPAN
=cut
sub POST{
my ($self, $req , $resp ) = @_ ;
$resp->data()->{'test_mess'} = 'This is a POST test message' ;
## It is OK
return Apache2::Const::HTTP_OK ;
}
=head2 PUT
Performs a fake PUT
=cut
sub PUT{
my ($self, $req , $resp ) = @_ ;
$resp->data()->{'test_mess'} = 'This is a PUT test message' ;
## It is OK
return Apache2::Const::HTTP_OK ;
}
=head2 DELETE
Performs a fake DELETE
=cut
( run in 0.461 second using v1.01-cache-2.11-cpan-c6e0e5ac2a7 )