Stop importing Carp functions (and thus polluting the inheritor
namespaces)
+ Make sure $_ is properly preserved even if the loaded module
+ is negligent enough to change it (RT#66661)
1.0008 24 Feb 2011
Fix inject_base regression introduced during optimizations in
return if ( *{"${f_class}::$_"}{CODE} );
}
-
# require always returns true on success
- eval { require($file) } or do {
+ # ill-behaved modules might very well obliterate $_
+ eval { local $_; require($file) } or do {
$@ = "Invalid class name '$f_class'" if $f_class =~ $invalid_class;
--- /dev/null
+use strict;
+use warnings;
+
+use Class::C3::Componentised;
+use Test::More;
+use FindBin;
+
+use lib "$FindBin::Bin/lib";
+
+my @mods = 'DestroyDollarUnderscore';
+
+for (@mods) {
+ Class::C3::Componentised->ensure_class_loaded($_);
+}
+
+is_deeply(\@mods, [ 'DestroyDollarUnderscore' ], '$_ untouched');
+
+done_testing;
--- /dev/null
+package DestroyDollarUnderscore;
+
+use warnings;
+use strict;
+
+undef ($_);
+
+1;