REST::Application 0.96 review
DownloadREST::Application is a framework for building RESTful web-applications. SYNOPSIS # MyRESTApp L instance / mod_perl handler
|
|
REST::Application is a framework for building RESTful web-applications.
SYNOPSIS
# MyRESTApp L instance / mod_perl handler
package MyRESTApp;
use Apache;
use Apache::Constants qw(:common);
sub handler {
__PACKAGE__->new(request => $r)->run();
return OK;
}
sub getMatchText { return Apache->uri }
sub setup {
my $self = shift;
$self->resourceHooks(
qr{/rest/parts/(d+)} => 'get_part',
# ... other handlers here ...
);
}
sub get_part {
my ($self, $part_num) = @_;
# Business logic to retrieve part num
}
# Apache conf
< Location /rest >
perl-script .cgi
PerlHandler MyRESTApp
< /Location >
This module acts as a base class for applications which implement a RESTful interface. When an HTTP request is received some dispatching logic in REST::Application is invoked, calling different handlers based on what the kind of HTTP request it was (i.e. GET, PUT, etc) and what resource it was trying to access. This module won't ensure that your API is RESTful but hopefully it will aid in developing a REST API.
Requirements:
Perl
REST::Application 0.96 keywords