X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FDispatcher.pm;h=5a975ed7ef14acad683fd7bd557e980e2df90156;hb=f87b7c218042591dace942198aed7939f1782dfb;hp=cb22e63a6b9b6fa824bf2a9455e2090117ca8fc0;hpb=1315d253bbf854cbd9740ef4323a9930411b9fa0;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Dispatcher.pm b/lib/Catalyst/Dispatcher.pm index cb22e63..5a975ed 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 { @@ -370,9 +370,7 @@ sub prepare_action { DESCEND: while (@path) { $path = join '/', @path; - $path =~ s#^/##; - - $path = '' if $path eq '/'; # Root action + $path =~ s#^/+##; # Check out dispatch types to see if any will handle the path at # this level @@ -459,9 +457,6 @@ sub get_containers { } return reverse grep { defined } @containers, $self->_container_hash->{''}; - - #return (split '/', $namespace); # isnt this more clear? - my @parts = split '/', $namespace; } =head2 $self->uri_for_action($action, \@captures) @@ -535,9 +530,8 @@ sub register { my @normal_dtypes; my @low_precedence_dtypes; - while (my $type = shift @dtypes) { - if ($type->isa('Catalyst::DispatchType::Index') || - $type->isa('Catalyst::DispatchType::Default')) { + for my $type ( @dtypes ) { + if ($type->_is_low_precedence) { push @low_precedence_dtypes, $type; } else { push @normal_dtypes, $type; @@ -660,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 $@; @@ -687,10 +680,9 @@ 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;