update some warnings
Brian Cassidy [Fri, 30 May 2008 12:54:43 +0000 (12:54 +0000)]
lib/Catalyst.pm

index 13218e3..83366f5 100644 (file)
@@ -536,6 +536,7 @@ sub model {
         $c->log->warn( '* $c->config->{default_model} # the name of the default model to use' );
         $c->log->warn( '* $c->stash->{current_model} # the name of the model to use for this request' );
         $c->log->warn( '* $c->stash->{current_model_instance} # the instance of the model to use for this request' );
+        $c->log->warn( 'NB: in version 5.80, the "random" behavior will not work at all.' );
     }
 
     return $c->_filter_component( $comp );
@@ -583,6 +584,7 @@ sub view {
         $c->log->warn( '* $c->config->{default_view} # the name of the default view to use' );
         $c->log->warn( '* $c->stash->{current_view} # the name of the view to use for this request' );
         $c->log->warn( '* $c->stash->{current_view_instance} # the instance of the view to use for this request' );
+        $c->log->warn( 'NB: in version 5.80, the "random" behavior will not work at all.' );
     }
 
     return $c->_filter_component( $comp );
@@ -657,7 +659,12 @@ sub component {
 
         my @result = grep { m{$query} } keys %{ $c->components };
         return @result if ref $name;
-        return $result[ 0 ] if $result[ 0 ];
+
+        if( $result[ 0 ] ) {
+            $c->log->warn( 'Relying on the regexp fallback behavior for component resolution' );
+            $c->log->warn( 'is unreliable and unsafe. You have been warned' );
+            return $result[ 0 ];
+        }
 
         # I would expect to return an empty list here, but that breaks back-compat
     }