NAME
Limper - extremely lightweight but not very powerful web application framework
VERSION
Version 0.001
SYNOPSIS
use Limper;
my $generic = sub { 'yay' };
get '/' => $generic;
post '/' => $generic;
post qr{^/foo/} => sub {
status 202, 'whatevs';
headers Foo => 'bar', Fizz => 'buzz';
'you posted something: ' . request->{body};
};
limp;
DESCRIPTION
Limper
is designed primarily to be a simple HTTP/1.1 test server in perl. It has a simple syntax like Dancer, but no dependencies at all (expect for the tests), unlike the dozens that Dancer pulls in. It also does little to no processing of requests nor formatting of responses. This is by design, othewise, just use Dancer. There is also no PSGI support or other similar fanciness.
EXPORTS
The following are all exported by default:
get head post put delete trace
status headers request limp
FUNCTIONS
get
head
post
put
delete
trace
Defines a route handler for METHOD to the given path:
get '/' => sub { 'Hello world!' };
status
Get or set the response status, and optionally reason.
status 404;
status 401, 'Nope';
my $status = status;
my ($status, $reason) = status;
headers
Get or set the response headers.
headers Foo => 'bar', Fizz => 'buzz';
my @headers = headers;
my $headers = headers;
request
Returns a HASH
of the request. Request keys are: method
, uri
, and version
. It may also contain headers
which is an ARRAY
, hheaders
which is a HASH
form of the headers, and body
.
There is no decoding of the body content nor URL paramters.
limp
Starts the server. You can pass it the same options as IO::Socket::INET takes. The default options are:
Listen => 5, ReuseAddr => 1, LocalAddr => 'localhost', LocalPort => 8080, Proto => 'tcp'
This keyword should be called at the very end of the script, once all routes are defined. At this point, Limper takes over control.
COPYRIGHT AND LICENSE
Copyright (C) 2014 by Ashley Willis <ashley@gitable.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.4 or, at your option, any later version of Perl 5 you may have available.