Crackers2 has asked for the wisdom of the Perl Monks concerning the following question:
Module:
package MyModule; use IO::Socket::INET; 1;
Main script:
use MyModule; my $socket = IO::Socket::INET->new();
This works fine, but if I now replace/reimplement MyModule so that it has the same API (intended to be a drop-in replacement) but doesn't need (and thus use) IO::Socket::INET internally, the main script will break because it can't find IO::Socket::INET anymore.
To avoid something like this from happening, I was wondering if it's possible to stop use statements within modules from effectively propagating into their caller. This would mean that the example I posted would break and force me to use IO::Socket::INET right away, preventing issues later on.
(This bleeding actually seems to go both ways. I just had a module break on me because I removed a use of another module from my main script. And in this it was actually one of the modules used by the module I removed that actually used the module needed by the second module.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Preventing used modules from leaking to main script
by jdtoronto (Prior) on Sep 20, 2006 at 15:33 UTC | |
by Crackers2 (Parson) on Sep 20, 2006 at 16:48 UTC | |
by Hue-Bond (Priest) on Sep 20, 2006 at 17:02 UTC | |
by jdtoronto (Prior) on Sep 20, 2006 at 17:55 UTC | |
|
Re: Preventing used modules from leaking to main script
by ikegami (Patriarch) on Sep 20, 2006 at 15:45 UTC | |
|
Re: Preventing used modules from leaking to main script (symbolic--)
by tye (Sage) on Sep 20, 2006 at 20:09 UTC |