Commit | Line | Data |
4ed4fb42 |
1 | package Web::Simple::DispatchNode; |
2 | |
3 | use Moo; |
4 | |
5 | extends 'Web::Dispatch::Node'; |
6 | |
7 | has _app_object => (is => 'ro', init_arg => 'app_object', required => 1); |
8 | |
67a6b9da |
9 | # this ensures that the dispatchers get called as methods of the app itself |
4ed4fb42 |
10 | around _curry => sub { |
11 | my ($orig, $self) = (shift, shift); |
bfa34345 |
12 | my $code = $self->$orig($self->_app_object, @_); |
13 | ref($_[0]) eq 'HASH' |
14 | ? do { my $v = $_[0]; sub { local *_ = $v; &$code } } |
15 | : $code |
4ed4fb42 |
16 | }; |
17 | |
18 | 1; |