From: John Napiorkowski Date: Thu, 18 Jul 2013 02:29:25 +0000 (-0400) Subject: outline for PSGI middleware X-Git-Tag: 5.90050~1^2~64 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=15c53843b71c205623fe9fc949c1b728eb8ff4ad;hp=150345eba628e56f9d481be224bec950b114a32c outline for PSGI middleware --- diff --git a/Changes b/Changes index 0a1b682..a7a9d5d 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ # This file documents the revision history for Perl extension Catalyst. +5.90XXX - TBA + - Declare PSGI compliant Middleware as part of your Catalyst Application + 5.90042 - 2013-06-14 - Removed more places where an optional dependency shows up in the test suite. Hopefully really fixed the unicode regression introduced in 5.90040 diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index dc2e122..d0c2f27 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -3044,6 +3044,27 @@ the plugin name does not begin with C. } } +sub setup_middleware { } + +our @registered_middlewares = (); + +## A normalized read only list of PSGI Middleware +sub registered_middlewares { @registered_middlewares } + +## Normalize incoming middleware and hold it +sub register_middleware { + my($self, $mw, @args) = @_; + + if (ref $mw ne 'CODE') { + my $mw_class = Plack::Util::load_class($mw, 'Plack::Middleware'); + $mw = sub { $mw_class->wrap($_[0], @args) }; + } + + push @registered_middlewares, $mw; +} + +sub apply_registered_middleware { } + =head2 $c->stack Returns an arrayref of the internal execution stack (actions that are