Perl: the Markov chain saw | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Before you go and do that, you should probably hear the reasons why it's sometimes (not always), appropriate to import functions into your namespace, or something similar. Consider the possibility that down the road, you have issues with MySubPackage in a script, but you still need it for other scripts on the system, so don't want to completely overwrite the module. You create MySubPackage2, which has the same interface as the original MySubPackage, and then you just need to change one line of code in this script:
If you use fully qualified calls, then you have to go through the script, and find/replace everything, which might be more time consuming. You may also decide that you want to have some logic in your script that dynamically loads the proper 'some_function()' to be used throughout the script, based on other parameters -- in this situation, you want the lines of code that call the function to not worry about what they're actually calling. Sometimes, tradeoffs in execution time cuts down on the time and effort to change the code down the road, (is part of the issue with premature optimization, which halley mentioned) In reply to Re^3: package function calling
by jhourcle
|
|