NAME

Limper::Sugar - sugary things like Dancer does

VERSION

version 0.002

SYNOPSIS

use Limper::Sugar;
use Limper;   # this must come after all extensions

# routes

limp;

DESCRIPTION

Limper::Sugar extends Limper to have sugary things like in Dancer.

NOTE: this is all as yet untested.

USE OF THIS MODULE IS STRONGLY DISCOURAGED IN PUBLIC CODE. DO NOT USE IT IN A PLUGIN. It is meant to facilitate switching from Dancer. Consider everything in here deprecated. Some of these may end up in Limper proper at some point, while others offer no significant benefit. If you really feel it should be in Limper, make a request.

EXPORTS

The following are all additionally exported by default:

limper_version load captures dirname halt send_error uri_for redirect content_type path

FUNCTIONS

limper_version

Returns the version of Limper in use.

load

Sugar around Perl's require, but can take a list of expressions to require.

captures

Returns a copy of %+ (named capture groups) as a hashref.

dirname

Exactly the same as "dirname" in File::Basename.

uri_for

Prepends the request's X-Forwarded-Host or Host value to the path.

redirect

redirect $path, $status;

Sugar for the following, plus it will turn a Limper path into a URI.

status $status // 302;
headers Location => uri_for $path;

content_type

Sugar for headers 'Content-Type' => $type. Note that this does not support abbreviated content types.

path

Sugar around "catfile" in File::Spec.

halt

Merely returns @_.

Warning: In Dancer, this stops execution of the route. In Limper, there is currently no such mechanism. This may change in the future.

send_error

send_error $content, $status;

Sugar for the following:

status $status // 500;
$content;

Warning: In Dancer, this stops execution of the route. In Limper, there is currently no such mechanism. This may change in the future.

COPYRIGHT AND LICENSE

Copyright (C) 2014 by Ashley Willis <ashley+perl@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.

SEE ALSO

Limper