Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^4: OO Conversion Query - Sharing Data

by Anonymous Monk
on Apr 13, 2013 at 02:17 UTC ( [id://1028474]=note: print w/replies, xml ) Need Help??


in reply to Re^3: OO Conversion Query - Sharing Data
in thread OO Conversion Query - Sharing Data

So just to confirm, I make a variable called our $igaro in the root igaro.pm module, then bless the instantiated parent into it.

It does sound the way forward. If I'm right in saying the parent is never passed to the child (first parameter is a reference to the instantiation of that child) then I'd have to use a global variable.

But if I use a global variable some of the lower pm modules will be always expecting the parent to be in a fixed variable name ($igaro), which seems a bad idea.

  • Comment on Re^4: OO Conversion Query - Sharing Data

Replies are listed 'Best First'.
Re^5: OO Conversion Query - Sharing Data
by educated_foo (Vicar) on Apr 13, 2013 at 13:20 UTC
    In brief:
    $x = bless \%data, Igaro; $x->foo(...); # calls Igaro::foo($x, ...)
    Beyond that, I suggest reading perltoot and perlobj. The newer object docs are inferior (and, annoyingly, are replaced by stubs so the link shortcuts here aren't helpful).
Re^5: OO Conversion Query - Sharing Data
by Anonymous Monk on Apr 13, 2013 at 07:17 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1028474]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2024-04-26 05:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found