This was added in commit
732bb7c2d4f.
The changes in that commit did not necessitate the addition of
local $_. So the localisation is wasting CPU cycles. Worse, it
causes bugs in 5.12 and earlier. (local $_ is always wrong if you
don’t control what is in $_ already, because it could be a read-only
tied variable.) Actually, it causes bugs in 5.14-15 still, because
it seems that the changes to ‘local $_’ still weren’t sufficient (it
still calls FETCH, but not STORE). That itself needs fixing, but that
should not obviate the need for this change, as Exporter has been liv-
ing a double life.
my $export_cache = ($Cache{$pkg} ||= {});
my $args = @_ or @_ = @$exports;
- local $_;
if ($args and not %$export_cache) {
s/^&//, $export_cache->{$_} = 1
foreach (@$exports, @{"$pkg\::EXPORT_OK"});
BEGIN {
$test = 1;
- print "1..30\n";
+ print "1..31\n";
require Exporter;
ok( 1, 'Exporter compiled' );
}
::ok($Carp::Internal{Exporter}, "Carp recognizes Exporter");
::ok($Carp::Internal{'Exporter::Heavy'}, "Carp recognizes Exporter::Heavy");
+package Exporter::for::Tied::_;
+
+@ISA = 'Exporter';
+@EXPORT = 'foo';
+
+package Tied::_;
+
+sub TIESCALAR{bless[]}
+# no tie methods!
+
+{
+ tie my $t, __PACKAGE__;
+ for($t) { # $_ is now tied
+ import Exporter::for::Tied::_;
+ }
+}
+::ok(1, 'import with tied $_');