Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
? Instead, it printsnew[A] new[B]
Here's the code:new[A] Can't locate object method "new" via package "B" at test.pl line 6.
I'm not sure why B isn't getting A's new() method if B is an A.#! /usr/bin/perl use strict; use warnings; A->new(); B->new(); package A; sub new { print "new[$_[0]]\n"; } package B; use vars qw(@ISA); @ISA = qw/A/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Inheritance question
by pc88mxer (Vicar) on Jul 11, 2008 at 17:36 UTC | |
|
Re: Inheritance question
by Joost (Canon) on Jul 11, 2008 at 17:36 UTC | |
by Anonymous Monk on Jul 11, 2008 at 18:27 UTC | |
|
Re: Inheritance question
by FunkyMonk (Bishop) on Jul 11, 2008 at 17:38 UTC |