Dispatcher::Small - Small dispatcher with Regular-Expression
use Dispatcher::Small; my $ds = Dispatcher::Small->new( qr'^/user/(?<id>.+)' => { action => \&user }, qr'^/' => { action => \&root }, ); my $res = $ds->match('/user/oreore'); ### $res = { action => sub {...}, id => 'oreore' }
"Dispatcher::Small" is a dispatcher class that is written in perl, and is maybe smallest one of them in the world... maybe.
Dispatcher::Small requires perl-5.10 or later.
my %dispatch_rule = ( qr'^/user/(?<id>.+)' => \&user, qr'^/' => \&root, ); my $object = Dispatcher::Small->new( %dispatch_rule );
Constructor method.
my $res = $object->match('/user/oreore');
Returns matching result as hashref.
Copyright (C) ytnobody.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
ytnobody <ytnobody@gmail.com>
To install Dispatcher::Small, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dispatcher::Small
CPAN shell
perl -MCPAN -e shell install Dispatcher::Small
For more information on module installation, please visit the detailed CPAN module installation guide.