[Catalyst-commits] r13790 - Catalyst-Runtime/5.80/branches/psgi/lib
rafl at dev.catalyst.perl.org
rafl at dev.catalyst.perl.org
Mon Dec 6 12:08:49 GMT 2010
Author: rafl
Date: 2010-12-06 12:08:49 +0000 (Mon, 06 Dec 2010)
New Revision: 13790
Modified:
Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst.pm
Log:
Don't build the full PSGI app more than once
Modified: Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst.pm 2010-12-06 11:03:11 UTC (rev 13789)
+++ Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst.pm 2010-12-06 12:08:49 UTC (rev 13790)
@@ -71,7 +71,7 @@
__PACKAGE__->mk_classdata($_)
for qw/components arguments dispatcher engine log dispatcher_class
engine_class context_class request_class response_class stats_class
- setup_finished/;
+ setup_finished _psgi_app/;
__PACKAGE__->dispatcher_class('Catalyst::Dispatcher');
__PACKAGE__->engine_class('Catalyst::Engine');
@@ -2648,9 +2648,28 @@
return;
}
+=head2 $c->psgi_app
+
+Builds a PSGI application coderef for the catalyst application C<$c> using
+L</"$c->setup_psgi_app">, stores it internally, and returns it. On the next call
+to this method, C<setup_psgi_app> won't be invoked again, but its persisted
+return value of it will be returned.
+
+This is the top-level entrypoint for things that need a full blown Catalyst PSGI
+app. If you only need the raw PSGI application, without any middlewares, use
+L</"$c->raw_psgi_app"> instead.
+
+=cut
+
sub psgi_app {
my ($app) = @_;
- $app->setup_psgi_app;
+
+ unless ($app->_psgi_app) {
+ my $psgi_app = $app->setup_psgi_app;
+ $app->_psgi_app($psgi_app);
+ }
+
+ return $app->_psgi_app;
}
=head2 $c->setup_psgi_app
More information about the Catalyst-commits
mailing list