puterboy has asked for the wisdom of the Perl Monks concerning the following question:
Running, yields the error 'symbol "$globalVar" requires explicit package name'use strict; use warnings; MyPackage->import; #My main code $globalVar=1; myfunction(); #===================== BEGIN{ package MyPackage; require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(globalVar myfunction); our $globalVar; sub myfunction {} #Rest of package code... }
So, $globalVar seems to be in the namespace, I just can't seem to be able to use it (unless of course I explicitly address it using its originating namespace location as $MyPackage::globalVar)$VAR79 = 'globalVar'; $VAR80 = *::globalVar;
|
---|