in reply to Simple inheritance question
The main problem here is that you don't have a constructor for package One, so there's nothing for package Two to inherit. There are a lot of other little things with the code (like the fact that test() is a simple sub rather than a method, for example) which suggest the Perl OO tutorial perltoot might be a good item for you to read for a handle on how objects are handled in Perl.
Edit: I answered the wrong question and with an inaccurate answer. Then again, I learned something new about Perl and how it handles inheritance, so it wasn't a total loss.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Simple inheritance question
by halfcountplus (Hermit) on Apr 23, 2010 at 16:26 UTC | |
by webfiend (Vicar) on Apr 23, 2010 at 16:38 UTC | |
by halfcountplus (Hermit) on Apr 23, 2010 at 16:59 UTC | |
by BrowserUk (Patriarch) on Apr 23, 2010 at 21:09 UTC | |
by ikegami (Patriarch) on Apr 23, 2010 at 20:40 UTC | |
by webfiend (Vicar) on Apr 23, 2010 at 17:12 UTC | |
by chromatic (Archbishop) on Apr 23, 2010 at 19:36 UTC |
In Section
Seekers of Perl Wisdom