NAME

Eve::HttpResource - a base class for HTTP resource controllers.

SYNOPSIS

package Eve::HttpResource::SomeResource;

use parent qw(Eve::HttpResource);

sub _get {
    # some implementation here
}

DESCRIPTION

Eve::HttpResource is a class encapsulating all the actual processing of an HTTP request. _get(), _post() and _delete() methods can be overriden by the class derivatives. If not overriden this methods throw Eve::Exception::Http::405MethodNotAllowed.

Inside the described above methods class attributes _request, _response, _session_constructor and _dispatcher can be found.

Constructor arguments

response

an HTTP response object

session_constructor

a reference to a subroutine accepting the session id argument and returning a session object

dispatcher

an HTTP dispatcher object.

METHODS

init()

process()

Processes an HTTP request delegating control to the appropriate HTTP method implementation.

Arguments

matches_hash

a hash containing pattern matches from the URL.

request

an HTTP request object.

Throws

Eve::Exception::Http::405MethodNotAllowed

when a not allowed HTTP method specified.

Returns

a ready HTTP response object.

get_method_list()

Returns a list of supported HTTP methods.

Returns

A list reference.

SEE ALSO

Eve::Class
Eve::Exception

LICENSE AND COPYRIGHT

Copyright 2012 Igor Zinovyev.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

AUTHOR

Sergey Konoplev
Igor Zinovyev