NAME
Wurm::mob - Meal OBject. You asked.
SYOPSIS
use Wurm qw(mob);
...
sub handler {
my $meal = shift;
$meal->log->({level => 'debug', message => 'Meal OBjects!'});
$meal->res->header('Content-Type', 'text/plain');
$meal->res->content('Hi, '. $meal->req->address. '!');
return $meal->res;
}
...
DESCRIPTION
Tired of crummy old HASH
es in your request handlers? Upgrade them with the power of mob! There are two ways:
use Wurm::mob;
- or -
use Wurm qw(mob);
ADDITIONS
It wouldn't be correct to enable OO without adding some stuff! Here are some additions to the meal
that each of your request handlers will enjoy:
- req
-
Set to a
Plack::Request
object created with the current$env
. First class meals for first class requests. Can also be accessed withrequest()
. - res
-
Set to a
Plack::Response
object wth the status set to 200. Provides a very convenient way to generate PSGI responses andfinalize()
will be called for you. Can also be accessed withresponse()
.
ACCESSORS
The following accessors are provided for ease-of-abuse:
- mind
- env
- log
- req
- res
- tube
- seen
- grit
- vent
THE BAD NEWS
If mob is loaded, Wurm will automatically upgrade all incoming requests to use Wurm::mob
s for all meal
s for all applications. For ever. If you need to turn this behavior off in a particular application, you can add mob => 0
to your folding ruleset and meal
s will remain a HASH
.
SEE ALSO
AUTHOR
jason hord <pravus@cpan.org>
LICENSE
This software is information. It is subject only to local laws of physics.