App::MFILE::HTTP - general REST request forwarder for MFILE-based clients
use App::MFILE::HTTP qw( rest_req );
Module where rest_req and other shared code resides.
rest_req
Algorithm: send request to REST server, get JSON response, decode it, return it.
Takes a single _mandatory_ parameter: a LWP::UserAgent object
Optionally takes PARAMHASH:
server => [URI OF REST SERVER] default is 'http://0:5000' method => [HTTP METHOD TO USE] default is 'GET' nick => [NICK FOR BASIC AUTH] optional password => [PASSWORD FOR BASIC AUTH] optional path => [PATH OF REST RESOURCE] default is '/' req_body => [HASHREF] optional
Returns HASHREF containing:
hr => HTTP::Response object (stripped of the body) body => [BODY OF HTTP RESPONSE, IF ANY]
This function does the actual work for is_authorized in the Dispatch.pm module of an App::MFILE::WWW-based application.
is_authorized
App::MFILE::WWW
This function belongs in Dispatch.pm - it is here only to prevent code duplication.
Takes a single argument, the PSGI session, which is assumed to contain a last_seen attribute containing the number of seconds since epoch when the session was last seen.
last_seen
To install App::MFILE, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::MFILE
CPAN shell
perl -MCPAN -e shell install App::MFILE
For more information on module installation, please visit the detailed CPAN module installation guide.