X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FDispatcher.pm;h=d54d2ea2e7abcca3c22b0c20a66375013bc56a87;hb=9ec0ae77e9943964383d736b794afba36f2b3750;hp=680a76bb664dde9fc58bd5d2790973a79c0e5d75;hpb=5299fff8fe52a4f4c10698b258984e41a2f6964f;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Dispatcher.pm b/lib/Catalyst/Dispatcher.pm index 680a76b..d54d2ea 100644 --- a/lib/Catalyst/Dispatcher.pm +++ b/lib/Catalyst/Dispatcher.pm @@ -225,7 +225,7 @@ Documented in L sub go { my $self = shift; $self->_do_visit('go', @_); - die $Catalyst::GO; + Catalyst::Exception::Go->throw; } =head2 $self->forward( $c, $command [, \@arguments ] ) @@ -271,7 +271,7 @@ Documented in L sub detach { my ( $self, $c, $command, @args ) = @_; $self->_do_forward(detach => $c, $command, @args ) if $command; - die $Catalyst::DETACH; + Catalyst::Exception::Detach->throw; } sub _action_rel2abs { @@ -531,8 +531,7 @@ sub register { my @low_precedence_dtypes; for my $type ( @dtypes ) { - if ($type->isa('Catalyst::DispatchType::Index') || - $type->isa('Catalyst::DispatchType::Default')) { + if ($type->_is_low_precedence) { push @low_precedence_dtypes, $type; } else { push @normal_dtypes, $type; @@ -655,12 +654,11 @@ sub _load_dispatch_types { my ( $self, @types ) = @_; my @loaded; - # Preload action types for my $type (@types) { - my $class = - ( $type =~ /^\+(.*)$/ ) ? $1 : "Catalyst::DispatchType::${type}"; - + # first param is undef because we cannot get the appclass + my $class = Catalyst::Utils::resolve_namespace(undef, 'Catalyst::DispatchType', $type); + eval { Class::MOP::load_class($class) }; Catalyst::Exception->throw( message => qq/Couldn't load "$class"/ ) if $@; @@ -683,9 +681,8 @@ of course it's being used.) sub dispatch_type { my ($self, $name) = @_; - unless ($name =~ s/^\+//) { - $name = "Catalyst::DispatchType::" . $name; - } + # first param is undef because we cannot get the appclass + $name = Catalyst::Utils::resolve_namespace(undef, 'Catalyst::DispatchType', $name); for (@{ $self->_dispatch_types }) { return $_ if ref($_) eq $name;