Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: @ISA, Inheritance, and Class Methods

by btrott (Parson)
on Mar 13, 2001 at 10:35 UTC ( [id://64074]=note: print w/replies, xml ) Need Help??


in reply to @ISA, Inheritance, and Class Methods

You say:
> Undefined subroutine Foo::BarMod::whiz at line 17. > ... > Well, it's a class method, so the first one doesn't really > apply.
No it's not. That's not a class method--that's a fully-qualified subroutine 'whiz' in the class 'Foo::BarMod'. Very much not a class method. You're saying, "call the function 'whiz' in the package 'Foo::BarMod'". But such a function doesn't exist, so Perl doesn't like that.

If you want inheritance, call it as a class method, which is calling it like this:

Foo::BarMod->whiz
(Or indirect object syntax, but that's generally not used much.)

In other words: you came to the right conclusion, but you may have spared yourself quite a bit of confusion and frustration if you had your terms right. Inheritance--ie., checking in @ISA--only occurs for class methods (and object methods). Not for fully-qualified subroutines.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2024-04-23 09:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found