Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: using passed parent object reference to get at attributes

by mr_ron (Chaplain)
on Dec 20, 2015 at 14:50 UTC ( [id://1150800]=note: print w/replies, xml ) Need Help??


in reply to Re: using passed parent object reference to get at attributes
in thread using passed parent object reference to get at attributes

I wondered about doing "use parent" instead of working with @ISA for the test case. I didn't know but it turns out you can if the Perl isn't really ancient (I think you need 5.10.1). Instead of:

push @cChild::ISA, 'cParent';
one could also:
use parent -norequire, 'cParent';

In the real application, as opposed to the test example, the classes are probably broken up into seperate files and you probably just remove the '-norequire, '.

Ron

Replies are listed 'Best First'.
Re^3: using passed parent object reference to get at attributes
by previous (Sexton) on Dec 20, 2015 at 15:25 UTC
    @ISA is something I knew nothing about so thanks for raising it as a possibility...I see it's "Each package contains a special array called @ISA . The @ISA array contains a list of that class's parent classes, if any. This array is examined when Perl does method resolution, which we will cover later. " Thank you for the education!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-25 16:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found