Subject: | Sub::Current overwrites entire typeglob when importing |
Date: | Sun, 10 Jan 2010 19:12:15 +0100 |
To: | bug-Sub-Current [...] rt.cpan.org |
From: | Lukas Mai <l.mai [...] web.de> |
Hi,
instead of exporting just &ROUTINE (*foo = \&bar), Sub::Current exports the
entire typeglob (*foo = *bar), which has two unexpected consequences:
- It clobbers the calling package's $ROUTINE, @ROUTINE, etc.
- All packages that use Sub::Current suddenly have the same $ROUTINE,
@ROUTINE, etc.
Here's a demonstration:
#!perl
our $ROUTINE;
BEGIN { $ROUTINE = "ok"; }
use Sub::Current;
{
package Gramentian;
use Sub::Current;
our $ROUTINE = "not ok";
}
print $ROUTINE, "\n";
__END__
I think this is wrong. (At least it's not documented.)