X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst.pm;h=bed35031e2e49ebfa07423e2e90c1928bc1d27ca;hp=0403b00c1bcc0aa086a87f29e2582c605bf34bb5;hb=333ee5b679936b912e14493f114d1bff5f26b89f;hpb=364d7324169f5562a0e1405413005ba2ac656e88 diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 0403b00..bed3503 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_03'; sub import { my ( $class, @arguments ) = @_; @@ -790,15 +792,7 @@ EOF } if ( $class->debug ) { - - my @plugins = (); - - { - no strict 'refs'; - @plugins = - map { $_ . ' ' . ( $_->VERSION || '' ) } - grep { /^Catalyst::Plugin/ } @{"$class\::ISA"}; - } + my @plugins = map { "$_ " . ( $_->VERSION || '' ) } $class->registered_plugins; if (@plugins) { my $t = Text::SimpleTable->new(74); @@ -898,12 +892,12 @@ sub uri_for { my $params = ( scalar @args && ref $args[$#args] eq 'HASH' ? pop @args : {} ); - for my $value ( values %$params ) { - my $isa_ref = ref $value; - if( $isa_ref and $isa_ref ne 'ARRAY' ) { - croak( "Non-array reference ($isa_ref) passed to uri_for()" ); - } - utf8::encode( $_ ) for grep { defined } $isa_ref ? @$value : $value; + for my $value ( values %$params ) { + my $isa_ref = ref $value; + if( $isa_ref and $isa_ref ne 'ARRAY' ) { + croak( "Non-array reference ($isa_ref) passed to uri_for()" ); + } + utf8::encode( $_ ) for grep { defined } $isa_ref ? @$value : $value; }; # join args with '/', or a blank string @@ -1801,23 +1795,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 Class::Inspector->filename($component); + Catalyst::Utils::ensure_class_loaded( $component ); my $module = $class->setup_component( $component ); my %modules = (