add %_ setting
[catagits/Web-Simple.git] / lib / Web / Simple / DispatchNode.pm
index 36e5e67..3f37c05 100644 (file)
@@ -9,7 +9,10 @@ has _app_object => (is => 'ro', init_arg => 'app_object', required => 1);
 # this ensures that the dispatchers get called as methods of the app itself
 around _curry => sub {
   my ($orig, $self) = (shift, shift);
-  $self->$orig($self->_app_object, @_);
+  my $code = $self->$orig($self->_app_object, @_);
+  ref($_[0]) eq 'HASH'
+    ? do { my $v = $_[0]; sub { local *_ = $v; &$code } }
+    : $code
 };
 
 1;