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...
$interface->handler($client)->parse($local_file_name);
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.$Person->name('Homer') ->job('safety inspector') ->wife('Marge') ->fav_food('Duff');
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.
the_Don
...making offers others can't rufuse.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getting Confused with the '->' operator
by elusion (Curate) on Sep 30, 2002 at 22:34 UTC | |
|
Re: Getting Confused with the '->' operator
by BrowserUk (Patriarch) on Sep 30, 2002 at 22:51 UTC | |
|
Re: Getting Confused with the '->' operator
by robartes (Priest) on Sep 30, 2002 at 22:14 UTC | |
by charnos (Friar) on Oct 01, 2002 at 13:34 UTC | |
|
Re: Getting Confused with the '->' operator
by clintp (Curate) on Oct 01, 2002 at 00:28 UTC | |
|
Re: Getting Confused with the '->' operator
by the_Don (Scribe) on Oct 01, 2002 at 20:45 UTC |