[Chicago-talk] Inheritance

Steven Lembark lembark at wrkhors.com
Sat Jan 10 22:25:57 CST 2004


># !/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.

You have to put a package name on the globals. The
variable isn't lexical (i.e., my $thingy) so you have
to put a package name on it if you use strict.


--
Steven Lembark                               2930 W. Palmer
Workhorse Computing                       Chicago, IL 60647
                                            +1 888 359 3508



More information about the Chicago-talk mailing list