X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst.pm;h=552131209b346b0a4f409c48a64cf7a4535d2139;hb=488736aa8f612ac5f963a9c9f4794286525a335a;hp=9cb2b3f52b4aa84afd82be0482f8b3b1e5f45cb7;hpb=d8e0de58f51aa60a9f89fd70bdbee0539f7bc70e;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 9cb2b3f..5521312 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -59,7 +59,9 @@ __PACKAGE__->engine_class('Catalyst::Engine::CGI'); __PACKAGE__->request_class('Catalyst::Request'); __PACKAGE__->response_class('Catalyst::Response'); -our $VERSION = '5.6902'; +# Remember to update this in Catalyst::Runtime as well! + +our $VERSION = '5.70_01'; sub import { my ( $class, @arguments ) = @_; @@ -1801,23 +1803,29 @@ sub setup_actions { my $c = shift; $c->dispatcher->setup_actions( $c, @_ ) } =head2 $c->setup_components -Sets up components. +Sets up components. Specify a C config option to pass additional options +directly to L. To add additional search paths, specify a key named +C as an array reference. Items in the array beginning with C<::> will have the +application class name prepended to them. =cut sub setup_components { my $class = shift; + my @paths = qw( ::Controller ::C ::Model ::M ::View ::V ); + my $config = $class->config->{ setup_components }; + my $extra = delete $config->{ search_extra } || []; + + push @paths, @$extra; + my $locator = Module::Pluggable::Object->new( - search_path => [ - "${class}::Controller", "${class}::C", - "${class}::Model", "${class}::M", - "${class}::View", "${class}::V" - ], + search_path => [ map { s/^(?=::)/$class/; $_; } @paths ], + %$config ); for my $component ( sort { length $a <=> length $b } $locator->plugins ) { - require( join( '/', split( '::', $component ) ) . '.pm' ); + Catalyst::Utils::ensure_class_loaded( $component ); my $module = $class->setup_component( $component ); my %modules = (