From: Matt S Trout Date: Tue, 22 Jan 2013 16:30:27 +0000 (+0000) Subject: try not to lose the reference to $self X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2d08e5ba1dfaf7cda3d937e606ff9f330f0f052c;p=scpubgit%2FApp-SCS.git try not to lose the reference to $self --- diff --git a/lib/App/SCS.pm b/lib/App/SCS.pm index af606f1..035c803 100644 --- a/lib/App/SCS.pm +++ b/lib/App/SCS.pm @@ -84,7 +84,11 @@ sub load_plugin { sub run_if_script { my $self = shift; if (caller(1)) { - return $self->web->to_psgi_app; + my $code; + return sub { + $code ||= $self->web->to_psgi_app; + &$code + }; } else { return $self->run; }