Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Calling methods of object instance A from object instance B

by Anonymous Monk
on Nov 29, 2007 at 01:37 UTC ( #653739=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I'm writting home automation gateway for Linux MEdia Center application. I communicate with automation system via rs232 and have written separate object code for it...
On the other hand, I communicate with LMCE system via TCP socket (separate object code).
Majority of time I do poll of devices status on both interfaces. If any change occurs, then I have to send proper info also on another interface....

Now I'd like for instance use methods of first mentioned object instance in second mentioned object.
I tried simply by sending object A instance as parameter to method of object B and call method but it seems it doesn't work....

Any advice, example ?

Thanks in advance,
regards,
Bulek.

Comment on Calling methods of object instance A from object instance B
Re: Calling methods of object instance A from object instance B
by erroneousBollock (Curate) on Nov 29, 2007 at 01:53 UTC
    Now I'd like for instance use methods of first mentioned object instance in second mentioned object.
    I tried simply by sending object A instance as parameter to method of object B and call method but it seems it doesn't work....
    If I understand what you're saying, it should work fine.

    $A->methodfoo($B); # methodfoo will call $_[1]->methodbar();

    Could you post a cut-down example of your code that still exhibits the problem? Also, please remember to read Writeup Formatting Tips.

    -David

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://653739]
Approved by ikegami
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2015-07-03 13:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (53 votes), past polls