[Catalyst-commits] r9537 - in Catalyst-Runtime/5.80/trunk:
lib/Catalyst t
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Sat Mar 21 14:16:34 GMT 2009
Author: t0m
Date: 2009-03-21 14:16:33 +0000 (Sat, 21 Mar 2009)
New Revision: 9537
Added:
Catalyst-Runtime/5.80/trunk/t/unit_core_action_chained.t
Modified:
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Dispatcher.pm
Log:
Add the test from r9505, move the new method out of the POD where patch put it, and change to use _dispatch_types to suppress warning
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Dispatcher.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Dispatcher.pm 2009-03-21 14:08:25 UTC (rev 9536)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Dispatcher.pm 2009-03-21 14:16:33 UTC (rev 9537)
@@ -32,8 +32,8 @@
has _method_action_class => (is => 'rw', default => 'Catalyst::Action');
has _action_hash => (is => 'rw', required => 1, lazy => 1, default => sub { {} });
has _container_hash => (is => 'rw', required => 1, lazy => 1, default => sub { {} });
+has preload_dispatch_types => (is => 'rw', required => 1, lazy => 1, default => sub { [@PRELOAD] });
-has preload_dispatch_types => (is => 'rw', required => 1, lazy => 1, default => sub { [@PRELOAD] });
has postload_dispatch_types => (is => 'rw', required => 1, lazy => 1, default => sub { [@POSTLOAD] });
# Wrap accessors so you can assign a list and it will capture a list ref.
@@ -641,6 +641,20 @@
return @loaded;
}
+# Dont document this until someone else is happy with beaviour. Ash 2009/03/16
+sub dispatch_type {
+ my ($self, $name) = @_;
+
+ unless ($name =~ s/^\+//) {
+ $name = "Catalyst::DispatchType::" . $name;
+ }
+
+ for (@{ $self->_dispatch_types }) {
+ return $_ if ref($_) eq $name;
+ }
+ return undef;
+}
+
use Moose;
# 5.70 backwards compatibility hacks.
@@ -687,20 +701,6 @@
Provided by Moose
-# Dont document this until someone else is happy with beaviour. Ash 2009/03/16
-sub dispatch_type {
- my ($self, $name) = @_;
-
- unless ($name =~ s/^\+//) {
- $name = "Catalyst::DispatchType::" . $name;
- }
-
- for (@{ $self->dispatch_types }) {
- return $_ if ref($_) eq $name;
- }
- return undef;
-}
-
=head1 AUTHORS
Catalyst Contributors, see Catalyst.pm
Added: Catalyst-Runtime/5.80/trunk/t/unit_core_action_chained.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/unit_core_action_chained.t (rev 0)
+++ Catalyst-Runtime/5.80/trunk/t/unit_core_action_chained.t 2009-03-21 14:16:33 UTC (rev 9537)
@@ -0,0 +1,26 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 3;
+
+
+use TestApp;
+
+my $dispatch_type = TestApp->dispatcher->dispatch_type('Chained');
+isa_ok($dispatch_type, "Catalyst::DispatchType::Chained", "got dispatch type");
+
+# This test was failing due to recursion/OOM. set up an alarm so things dont
+# runaway
+local $SIG{ALRM} = sub {
+ ok(0, "Chained->list didn't loop");
+ die "alarm expired - test probably looping";
+};
+alarm 10;
+
+$dispatch_type->list("TestApp");
+ok(1, "Chained->list didn't loop");
More information about the Catalyst-commits
mailing list