X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FMiddleware%2FStash.pm;h=f3bbe68bf380d649b5ea97b9ca3387fe7745970f;hp=7102089c5eb7f381d6009ebf0749aa5d9c297a6e;hb=e77ad76e30c334b05bdef6cc5e5ef57304d8c309;hpb=300b04ce8f2591a09a4d43060dbb84c4f799131a diff --git a/lib/Catalyst/Middleware/Stash.pm b/lib/Catalyst/Middleware/Stash.pm index 7102089..f3bbe68 100644 --- a/lib/Catalyst/Middleware/Stash.pm +++ b/lib/Catalyst/Middleware/Stash.pm @@ -14,7 +14,7 @@ sub PSGI_KEY { 'Catalyst.Stash.v1' }; sub get_stash { my $env = shift; return $env->{PSGI_KEY} || - _init_stash($env); + _init_stash_in($env); } sub stash { @@ -23,7 +23,7 @@ sub stash { ->(@args); } -sub _generate_stash_closure { +sub _create_stash { my $stash = shift || +{}; return sub { if(@_) { @@ -38,15 +38,15 @@ sub _generate_stash_closure { }; } -sub _init_stash { +sub _init_stash_in { my ($env) = @_; return $env->{PSGI_KEY} ||= - _generate_stash_closure; + _create_stash; } sub call { my ($self, $env) = @_; - _init_stash($env); + _init_stash_in($env); return $self->app->($env); } @@ -79,8 +79,7 @@ Expect: $psgi_env. Exportable subroutine. -Get the stash out of the C<$env>. If the stash does not yet exist, we initialize -one and return that. +Get the stash out of the C<$env>. =head2 stash