package Test1;
use Devel::SawAmpersand qw(sawampersand);
use Exporter;
use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter);
@EXPORT = qw(testbelow);
sub testbelow {
print "Inside Test1::testbelow";
print "sawampersand? ", (sawampersand() ? "yes":"no");
print "Outside Test1::testbelow"
}
1;
####
package Test2;
use Exporter;
our @ISA = qw(Exporter);
# notice that we don't even export anything
sub showdollaramp {
$&;
}
1;
####
use Test1;
use Devel::SawAmpersand qw(sawampersand);
$\ = "\n"; # I'm lazy; puts \n at end of every print
print "sawampersand? ", (sawampersand() ? "yes":"no");
testbelow();
require Test2;
print "Loaded Test2";
print "sawampersand? ", (sawampersand() ? "yes":"no");
testbelow();
__DATA__
output:
sawampersand? no
Inside Test1::testbelow
sawampersand? no
Outside Test1::testbelow
Loaded Test2
sawampersand? yes
Inside Test1::testbelow
sawampersand? yes
Outside Test1::testbelow