use QStat;
foo();
print "QStat foo is: ", \&QStat::foo, "\n";
print "Imported foo is: ", \&main::foo, "\n";
<STDIN>;
my $loc = $INC{QStat};
delete $INC{QStat};
require $loc;
# slightly more difficult
# QStat->import();
print "After import, foo is: ", \&main::foo, "\n";
print "And in the package it is: ", \&QStat::foo, "\n";
Try it with and without the import(), and you'll see what's going on. *foo in the main package and *foo in QStat will point to different CVs, and that's the problem.
(The STDIN part is in there so I could change what foo() does while the program is running.)
I wonder if it would be worth writing a 'reimport' module... |