From: Jess Robinson Date: Sat, 2 Feb 2008 15:45:56 +0000 (+0000) Subject: Steal class loading code from Class::MOP, and get around errors when trying to load... X-Git-Tag: v1.001000~32 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c2bfa58afe329a6f9952b27a784db6f4065c1ad2;hp=bdce0c012c5b318a8bc1eed52873ac68bbb13908;p=p5sagit%2FClass-C3-Componentised.git Steal class loading code from Class::MOP, and get around errors when trying to load "__PACKAGE__" --- diff --git a/lib/Class/C3/Componentised.pm b/lib/Class/C3/Componentised.pm index 3aac337..b40dfd0 100644 --- a/lib/Class/C3/Componentised.pm +++ b/lib/Class/C3/Componentised.pm @@ -121,7 +121,9 @@ sub ensure_class_loaded { 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 + my $file = $f_class . '.pm'; + $file =~ s{::}{/}g; + eval { CORE::require($file) }; # require needs a bareword or filename if ($@) { if ($class->can('throw_exception')) { $class->throw_exception($@);