to_app alias
John Napiorkowski [Fri, 26 Sep 2014 16:42:43 +0000 (11:42 -0500)]
Changes
lib/Catalyst.pm
lib/Catalyst/Runtime.pm
t/aggregate/to_app.t [new file with mode: 0644]

diff --git a/Changes b/Changes
index 5c246ec..a9ed970 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
 # This file documents the revision history for Perl extension Catalyst.
 
+5.90080_001 - TBD
+  - MyApp->to_app is now an alias for MyApp->psgi_app in order to better support
+    existing Plack conventions.
+
 5.90073 - 2014-09-23
   - Fixed a regression caused by the last release where we broke what happened
     when you tried to set request parameters via $c->req->param('foo', 'bar').
index b904aa7..23ac3ad 100644 (file)
@@ -127,7 +127,7 @@ __PACKAGE__->stats_class('Catalyst::Stats');
 __PACKAGE__->_encode_check(Encode::FB_CROAK | Encode::LEAVE_SRC);
 
 # Remember to update this in Catalyst::Runtime as well!
-our $VERSION = '5.90073';
+our $VERSION = '5.90080_001';
 
 sub import {
     my ( $class, @arguments ) = @_;
@@ -2993,7 +2993,9 @@ sub apply_default_middlewares {
     return $psgi_app;
 }
 
-=head2 $c->psgi_app
+=head2 App->psgi_app
+
+=head2 App->to_app
 
 Returns a PSGI application code reference for the catalyst application
 C<$c>. This is the bare application without any middlewares
@@ -3004,6 +3006,8 @@ reference of your Catalyst application for use in F<.psgi> files.
 
 =cut
 
+*to_app = \&psgi_app;
+
 sub psgi_app {
     my ($app) = @_;
     my $psgi = $app->engine->build_psgi_app($app);
index fa9b74b..a8da289 100644 (file)
@@ -7,7 +7,7 @@ BEGIN { require 5.008003; }
 
 # Remember to update this in Catalyst as well!
 
-our $VERSION = '5.90073';
+our $VERSION = '5.90080_001';
 
 =head1 NAME
 
diff --git a/t/aggregate/to_app.t b/t/aggregate/to_app.t
new file mode 100644 (file)
index 0000000..7bcb497
--- /dev/null
@@ -0,0 +1,11 @@
+use strict;
+use warnings;
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+use TestApp;
+use Test::More;
+
+ok(TestApp->can('to_app'));
+is(ref(TestApp->to_app), 'CODE');
+
+done_testing;