Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^4: Data inheritance

by perlbaski (Acolyte)
on Sep 23, 2011 at 20:44 UTC ( #927613=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Data inheritance
in thread Data inheritance

Is there any other way of doing this apart from using global variables. I want to have common data variables in CommonObject.pm which I want to set in child class depending upon the type of child I create.

Also, I cannot seem to be able to set parent class variables in child class even with declaration using 'our'.

Looks like using exporter module is the only way to go.


Comment on Re^4: Data inheritance
Re^5: Data inheritance
by ikegami (Pope) on Sep 23, 2011 at 21:00 UTC

    Is there any other way of doing this apart from using global variables.

    Don't know. What are you doing? So far, you've only asked how to set a global variable. (You said class var, but that's the same thing.)

    Also, I cannot seem to be able to set parent class variables in child class even with declaration using 'our'

    Reread what I said: "which means you can access the array as @CommonObject::common_array from anywhere."

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2014-07-25 02:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (167 votes), past polls