Is there anything 'Bad (tm)' about creating a selective typeglob alias in
one package to a lexical that is definitely going to go out of scope in a
second package? It seems to work, but I feel like I may be missing
something...
For example, consider two packages, A and B. B has a subroutine which
executes the following (B knows about A):
sub foobar {
my $lexval = 'foo';
*A::bar = \$lexval;
}
My concern is that B::foobar is going to get called possibly multiple
times (it is okay that $A::bar is getting overwritten each
time B::foobar gets called.) Since $A::bar ends up holding the only
reference to $lexval once B::foobar exits, is the refcount decremented and
the first instance of $lexval cleaned up properly when B::foobar gets
called a second time, overwriting $A::bar?
--Chris