Make ensure_class_loaded behave better with malformed classnames
Marcus Ramberg [Wed, 18 Jul 2007 11:39:58 +0000 (11:39 +0000)]
Changes
lib/DBIx/Class/Componentised.pm

diff --git a/Changes b/Changes
index b94d2b5..aba03f9 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,6 @@
 Revision history for DBIx::Class
 
+       - ensure_class_loaded handles non-classnames better.
         - non-destructive hashref handling for connect_info options
         - count no longer returns negative values after slice
           (report and test from JOHANL)
index c635cee..1bb6a68 100644 (file)
@@ -69,6 +69,9 @@ sub _load_components {
 #      require
 sub ensure_class_loaded {
   my ($class, $f_class) = @_;
+
+  croak "Invalid class name $f_class"
+      if ($f_class=~m/(?:\b:\b|\:{3,})/);
   return if Class::Inspector->loaded($f_class);
   eval "require $f_class"; # require needs a bareword or filename
   if ($@) {