And that's exactly what I want to enforce.
You get that behaviour out of the box:
{ package FOO; use Data::Dumper; print Dumper \"bar"; } print Dumper \"baz"; __END__ Name "main::Dumper" used only once: possible typo at - line 7. $VAR1 = \'bar'; print() on unopened filehandle Dumper at - line 7.
However, if you call Dumper by its fully qualified name (ie Data::Dumper::Dumper, or IO::Socket::INET->new in your example), there's no way to prevent it from working:
{ package FOO; use Data::Dumper; print Dumper \"bar"; } no Data::Dumper; ## not even this print Data::Dumper::Dumper \"baz"; __END__ $VAR1 = \'bar'; $VAR1 = \'baz';
--
David Serrano
In reply to Re^3: Preventing used modules from leaking to main script
by Hue-Bond
in thread Preventing used modules from leaking to main script
by Crackers2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |