|Think about Loose Coupling|
strange code (de)referencing behaviorby dsb (Chaplain)
|on Feb 10, 2012 at 15:23 UTC||Need Help??|
dsb has asked for the
wisdom of the Perl Monks concerning the following question:
I've got some behavior I think is a bit odd, and I'm guessing it's just b/c of the way perl handles things internally, but I'm curious as to how/why this is happening.
I have a function being called by a code ref stored in a hash of code refs. The function is passed on the command line, and then by a series of conditions, is called from a class method of package Util.pm like so:
Where $fname is the name of a function parse() in a seperate package, Parse.pm.
In Parse.pm, parse()'s first few lines are
$isCombined is a variable meant to give the user the option to string a series of functions together into a collective check rather than run each individually. In this case, with parse() seeming called with no arguments, I expected $isCombined to be undefined.
However, it's getting set with the Util.pm object that contains the dispatch() method that is calling parse().
it almost seems like, behind the scenes, the full call looks like:
or something like that.
UPDATE: It actually looks like parse() is getting the same argument list that was passed to the function that called it, dispatch(), if that sheds any light for anyone.
Anyone have any insight? At this point, the simple answer is to just shift the object out of the way...no biggie. But I'm really just curious about what's happening here.
This @ISA my( $cool ) %SIG