iiijjjiii has asked for the wisdom of the Perl Monks concerning the following question:
1. Load a module that is never used.
#!/usr/bin/perl use strict; use Foo; use Bar; # Needless my $foo = Foo->new();
2. Forget to explicitly load a module.
#!/usr/bin/perl use strict; use Foo; my $bar = Bar->new(); # Works because Bar is loaded by Foo
In a separate module...
package Foo; use Bar; sub new { ... }
If package Foo is ever modified such that it no longer uses Bar, the script goes kaboom.
Any suggestions on how to reveal these in scripts other than scanning the code? Do you use any practices to prevent them?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How do you uncover needless module loads or missing loads in code.
by toolic (Bishop) on Jul 15, 2009 at 19:12 UTC | |
|
Re: How do you uncover needless module loads or missing loads in code.
by hesco (Deacon) on Jul 15, 2009 at 21:57 UTC | |
|
Re: How do you uncover needless module loads or missing loads in code.
by ELISHEVA (Prior) on Jul 16, 2009 at 09:34 UTC | |
|
Re: How do you uncover needless module loads or missing loads in code.
by GrandFather (Saint) on Jul 16, 2009 at 10:16 UTC |