in reply to Re^2: Error: Can't use string as a hash ref
in thread Error: Can't use string as a hash ref
I would have expected that an instance of the base class would have been returned.You should read more on Object Oriented Programming. This is not how inheritance works. Try this:
{ package MyBase; sub new { my $class = shift; warn "Constructing $class\n"; bless {}, $class; } } { package MyChild; use base 'MyBase'; } package main; use feature 'say'; my $p = MyBase->new; my $ch = MyChild->new; say for $p, $ch;
Updated: MyBase quoted in "use base".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Error: Can't use string as a hash ref
by Nocturnus (Scribe) on Apr 28, 2012 at 17:01 UTC |