From: Christian Walde Date: Wed, 20 Nov 2013 22:19:51 +0000 (+0100) Subject: stick DispatchNode comments to the appropiate code X-Git-Tag: v0.021~12 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FWeb-Simple.git;a=commitdiff_plain;h=d20b763a1ce47f0bcbe7facf56cec232ece7533f stick DispatchNode comments to the appropiate code --- diff --git a/lib/Web/Simple/DispatchNode.pm b/lib/Web/Simple/DispatchNode.pm index a69d26c..f3b0e56 100644 --- a/lib/Web/Simple/DispatchNode.pm +++ b/lib/Web/Simple/DispatchNode.pm @@ -6,12 +6,12 @@ extends 'Web::Dispatch::Node'; has _app_object => (is => 'ro', init_arg => 'app_object', required => 1); -# this ensures that the dispatchers get called as methods of the app itself -# and if the first argument is a hashref, localizes %_ to it to permit -# use of $_{name} inside the dispatch sub around _curry => sub { my ($orig, $self) = (shift, shift); + # this ensures that the dispatchers get called as methods of the app itself my $code = $self->$orig($self->_app_object, @_); + # if the first argument is a hashref, localize %_ to it to permit + # use of $_{name} inside the dispatch sub ref($_[0]) eq 'HASH' ? do { my $v = $_[0]; sub { local *_ = $v; &$code } } : $code