Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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 pondering the Monastery: (10)
As of 2014-12-18 06:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (43 votes), past polls