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

Re^2: Inheritance in Perl5

by EvanCarroll (Chaplain)
on Aug 08, 2009 at 17:46 UTC ( #787082=note: print w/replies, xml ) Need Help??


in reply to Re: Inheritance in Perl5
in thread Inheritance in Perl5

The moose way you speak of:
package Animal; use Moose; has [qw/name age/] => ( isa => 'Str', is => 'rw' ); package Horse; use Moose; extends 'Animal'; sub present { my $self = shift; print $self->isa('Animal') ? "I am an animal" : "I am not animal" }
With that said, I think there is something seriously wrong if you want your subclass to confirm that it inherits from the parent class in a method ;)


Evan Carroll
The most respected person in the whole perl community.
www.EvanCarroll.com

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://787082]
help
Chatterbox?
[Lady_Aleena]: choroba, the tables in that group of modules is from the World Builder's Guidebook, so I thought it best to add the name of the book to the name of the module.
[choroba]: oh, I see
[Lady_Aleena]: There is the RolePlaying:: WorldBuilding:: WorldBuildersGuide book suite and the RolePlaying:: WorldBuilding:: HighLevelCampaigns suite.

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2017-05-24 22:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?