+ - Add %_ alias if first argument is a hashref
- Un-mark upload matches as experimental since they work
0.018 - 2012-07-15
# 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;
--- /dev/null
+use Web::Simple 'TestApp';
+use Test::More;
+
+sub TestApp::dispatch_request {
+ sub (GET + ?*) {
+ [ 200, [ 'Content-type' => 'text/plain' ], [ $_{foo} ] ]
+ }
+}
+
+my $res = TestApp->new->run_test_request(GET => '/?foo=bar');
+
+is($res->content, 'bar', '%_ set ok');
+
+done_testing;