in reply to Re: My first attempt at inheritance
in thread My first attempt at inheritance
"Your first routine calls IO::DIR::pl->new, but I don't see any 'new' in IO::dir::pl.
"You *can't rely* on inheritance yet, as you don't have a Blessed Object!"
Not true. Inheritance works on class methods too. Look ma, no blessed objects!
use v5.12; use strict; use warnings; require File::Spec; @File::Spectacles::ISA = "File::Spec"; say File::Spectacles->tmpdir;
The OP's entire problem was that he was trying to rely on IO::Dir::pl's inheritance, before he'd assigned anything to @ISA.
Adding @IO::Dir::pl::ISA = "IO::Dir" to the beginning of the file suffices to fix it. (Though it's probably not the solution I'd use personally.)
Update: sorry - fixed code.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: My first attempt at inheritance
by perl-diddler (Chaplain) on Jun 01, 2013 at 10:18 UTC |