tomgracey has asked for the wisdom of the Perl Monks concerning the following question:
I copied this directly from http://perldoc.perl.org/perlboot.html. When I run it I get#!/usr/bin/perl use strict; Cow->speak; { package Animal; sub speak { my $class = shift; print "a $class goes ", $class->sound, "!\n"; } } { package Cow; our @ISA = qw(Animal); sub sound { "moooo" } }
In fact I can't seem to get inheritance to work at all. What extremely silly thing am I (not) doing? ThanksCan't locate object method "speak" via package "Cow" at ./testOO1.pl line 6.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: really simple OO inheritance question
by jdporter (Paladin) on Jun 27, 2010 at 12:15 UTC | |
by tomgracey (Scribe) on Jun 27, 2010 at 13:19 UTC | |
|
Re: really simple OO inheritance question
by moritz (Cardinal) on Jun 27, 2010 at 12:07 UTC |