Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^6: perl inheritance

by Anonymous Monk
on Mar 29, 2012 at 15:39 UTC ( [id://962431]=note: print w/replies, xml ) Need Help??


in reply to Re^5: perl inheritance
in thread perl inheritance

in other words, I'm getting the following error when I try to call $class->new(...)
Can't locate object method "new" via package "HASH" (perhaps you forgo +t to load "HASH"?) at Table.pm line 34. at Table.pm line 34
I thought that reftype would return the polymorphic type (i.e. the subclass). Sorry Chromatic, but I'm bit confused here..

Replies are listed 'Best First'.
Re^7: perl inheritance
by tangent (Parson) on Mar 29, 2012 at 16:11 UTC
    Yes, reftype() returns the type of the variable. I think what was meant was blessed() which returns the name of the package that it is blessed into:
    my $class = blessed $self;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2024-04-18 15:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found