yoda54 has asked for the wisdom of the Perl Monks concerning the following question:
I have a small inheritance hierarchy in the same file, but how come B can't seen to see A?
Thanks!
I keep getting:
Can't locate object method "new" via package "B" at ./example line 7.
#!/usr/bin/perl use strict; use warnings; require B; my $a = B->new(); package A; use strict; use warnings; sub new { my ($class, %args) = @_; my $self = bless { }, ref($class) || $class; return $self; } 1; package B; use strict; use warnings; require A; @B::ISA = qw(A); sub _init { my ($self, %args) = @_; $self->{_title} = $args{title} || undef; } 1;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Inheritance in the same file
by Corion (Pope) on Jun 11, 2013 at 07:43 UTC | |
by stephen (Priest) on Jun 11, 2013 at 17:19 UTC | |
by yoda54 (Monk) on Jun 12, 2013 at 08:04 UTC | |
by yoda54 (Monk) on Jun 11, 2013 at 07:58 UTC |