|The stupid question is the question not asked|
Getting Confused with the '->' operatorby the_Don (Scribe)
|on Sep 30, 2002 at 21:45 UTC||Need Help??|
the_Don has asked for the
wisdom of the Perl Monks concerning the following question:
OK, the easiet way for me to explain this is to show you a line of code that I have at work...
My question, I hope, is trivial... 'Which methods are invoked on which objects?'
I have seen examples that piggy-back the '->' operator:
Obviosly all the method calls are targeted at the Person object (I mean a job does not have a wife, and we all know that Marge's favorite food is potatoes!) but other times I'll see things like the first line from work where it looks like each call is invoked on the last referenced object.
Does it depend on what each of those calls are returning? i.e. a return of undef forces Perl to make the call on the next previously defined object? Or is there some other rule that I am not aware of?
I have gone through the Object chapter of Programming Perl, 3rd Edition. Feel free to direct me within that text or on-line for an existing explanation. I may have just missed it as a result of my frustration.