[Catalyst-commits] r7504 -
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst
groditi at dev.catalyst.perl.org
groditi at dev.catalyst.perl.org
Sat Mar 15 05:08:08 GMT 2008
Author: groditi
Date: 2008-03-15 05:08:08 +0000 (Sat, 15 Mar 2008)
New Revision: 7504
Modified:
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Dispatcher.pm
Log:
load classes with Class::MOP::load_class
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Dispatcher.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Dispatcher.pm 2008-03-15 05:03:50 UTC (rev 7503)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Dispatcher.pm 2008-03-15 05:08:08 UTC (rev 7504)
@@ -1,6 +1,7 @@
package Catalyst::Dispatcher;
use Moose;
+use Class::MOP;
use Catalyst::Exception;
use Catalyst::Utils;
@@ -50,7 +51,7 @@
=head1 METHODS
-=head2 new
+=head2 new
Construct a new dispatcher.
@@ -59,7 +60,7 @@
sub BUILD {
my ($self, $params) = @_;
- my $container =
+ my $container =
Catalyst::ActionContainer->new( { part => '/', actions => {} } );
$self->_tree( Tree::Simple->new( $container, Tree::Simple->ROOT ) );
@@ -136,7 +137,7 @@
}
my @args;
-
+
if ( ref( $extra_params[-1] ) eq 'ARRAY' ) {
@args = @{ pop @extra_params }
} else {
@@ -302,12 +303,12 @@
return $self->_action_hash->{"$namespace/$name"};
}
-=head2 $self->get_action_by_path( $path );
-
-Returns the named action by its full path.
+=head2 $self->get_action_by_path( $path );
-=cut
+Returns the named action by its full path.
+=cut
+
sub get_action_by_path {
my ( $self, $path ) = @_;
$path =~ s/^\///;
@@ -394,7 +395,8 @@
next if $key eq 'Private';
my $class = "Catalyst::DispatchType::$key";
unless ( $registered->{$class} ) {
- eval "require $class";
+ #eval "require $class";
+ eval { Class::MOP::load_class($class) };
push( @{ $self->_dispatch_types }, $class->new ) unless $@;
$registered->{$class} = 1;
}
@@ -512,7 +514,8 @@
for my $type (@types) {
my $class =
( $type =~ /^\+(.*)$/ ) ? $1 : "Catalyst::DispatchType::${type}";
- eval "require $class";
+ #eval "require $class";
+ eval { Class::MOP::load_class($class) };
Catalyst::Exception->throw( message => qq/Couldn't load "$class"/ )
if $@;
push @{ $self->_dispatch_types }, $class->new;
More information about the Catalyst-commits
mailing list