A
Andrew
Seems like we're missing the "will not stay shared" warning for anon
subs declared via "use constant". Is this a bug? Please cc: me on
replies.
use strict;
use warnings;
sub foo{
my($c,$d,$e)=("x","y","z");
my $bob=sub{$c=$_[0] if @_};
use constant sue => sub{$d=$_[0] if @_}; #line 6
sub hal {$e=$_[0] if @_} #line 7
$bob->(@_);
sue->(@_);
hal(@_);
print "c=$c d=$d e=$e\n";
}
foo("q");
foo();
foo("a");
foo("b");
__END__
output:
------------------------
Variable "$e" will not stay shared at testshared.pl line 7.
c=q d=q e=q
c=x d=y e=z
c=a d=y e=z
c=b d=y e=z
subs declared via "use constant". Is this a bug? Please cc: me on
replies.
use strict;
use warnings;
sub foo{
my($c,$d,$e)=("x","y","z");
my $bob=sub{$c=$_[0] if @_};
use constant sue => sub{$d=$_[0] if @_}; #line 6
sub hal {$e=$_[0] if @_} #line 7
$bob->(@_);
sue->(@_);
hal(@_);
print "c=$c d=$d e=$e\n";
}
foo("q");
foo();
foo("a");
foo("b");
__END__
output:
------------------------
Variable "$e" will not stay shared at testshared.pl line 7.
c=q d=q e=q
c=x d=y e=z
c=a d=y e=z
c=b d=y e=z