What if you are putting the code above into a module and then use that module in a program?
I might be missing something here, but it still seems to work ok:
## My_Foo.pm
package My_Foo;
BEGIN {
use strict;
use warnings;
use Carp;
use Digest::MD5;
our %inc_copy = %INC;
};
use Net::FTP;
%INC = %inc_copy;
1;
## test.pl
use Math::BigInt;
use My_Foo;
for(keys(%INC)) {print "$_: $INC{$_}\n"}
Net::FTP and the modules it loads are still missing from %INC.
Cheers, Rob | [reply] [Watch: Dir/Any] [d/l] [select] |
When I run this, Net::FTP is there. Thanks though. You made me think about it in a new way.
| [reply] [Watch: Dir/Any] |
When I run this, Net::FTP is there
Odd .. it's certainly not there for me on Win32, perl 5.8.8 - irrespective of which of the 2 modules is loaded first by the script.
D:\pscrpt>perl test.pl
XSLoader.pm: D:/perl58_M/5.8.8/lib/XSLoader.pm
warnings/register.pm: D:/perl58_M/5.8.8/lib/warnings/register.pm
My_Foo.pm: My_Foo.pm
warnings.pm: D:/perl58_M/5.8.8/lib/warnings.pm
Digest/base.pm: D:/perl58_M/5.8.8/lib/Digest/base.pm
integer.pm: D:/perl58_M/5.8.8/lib/integer.pm
Carp.pm: D:/perl58_M/5.8.8/lib/Carp.pm
Math/BigInt.pm: D:/perl58_M/5.8.8/lib/Math/BigInt.pm
strict.pm: D:/perl58_M/5.8.8/lib/strict.pm
Exporter.pm: D:/perl58_M/5.8.8/lib/Exporter.pm
vars.pm: D:/perl58_M/5.8.8/lib/vars.pm
constant.pm: D:/perl58_M/5.8.8/lib/constant.pm
Math/BigInt/Calc.pm: D:/perl58_M/5.8.8/lib/Math/BigInt/Calc.pm
Digest/MD5.pm: D:/perl58_M/5.8.8/lib/Digest/MD5.pm
overload.pm: D:/perl58_M/5.8.8/lib/overload.pm
Oh, well ... such is life :-)
Cheers, Rob | [reply] [Watch: Dir/Any] [d/l] |