[Chicago-talk] Inheritance
petemar1
petemar1 at perlmonk.org
Sat Jan 10 13:34:40 CST 2004
Given the following 2 separate files:
#!/usr/local/bin/perl -w
# BaseClass.pm
package BaseClass;
require BaseClass;
use strict;
use warnings;
{
sub new {
# my ($classname, @args) = @_;
# my ($classname, @args) = shift;
my $classname = shift;
my $self = bless{}, $classname;
return $self;
}
sub doTheThing() {
print"\n yes \n";
}
}
#!/usr/local/bin/perl -w
# DerivedClass.pl
package DerivedClass;
use strict;
use warnings;
# use base qw( BaseClass );
use lib qw( /home/petemar1/my_code/my_perl/ooperl/ooptest/BaseClass );
@MyApp::ISA = qw( BaseClass );
{
$theDoer = BaseClass->new();
# $theDoer = new BaseClass;
# $theDoer->doTheThing();
}
What does the following error mean?
% perl DerivedClass.pl
Global symbol "$theDoer" requires explicit package name at DerivedClass.pl
line 14.
Execution of DerivedClass.pl aborted due to compilation errors.
More information about the Chicago-talk
mailing list