sonic has asked for the wisdom of the Perl Monks concerning the following question:
I believe this successfully exports the scalars because the interpreter doesn't complain when I access them from a pl file where use strict is enabled. However, when I try to access these variables, they are set to no value:use Exporter; use vars qw(@ISA @EXPORT $VERSION); @ISA = qw(Exporter); @EXPORT = qw(Execute GetValue $PACKAGE_REQUEST_ID $BUGNUMBER $KBARTICL +E $DISTMETHOD $MINSP $MAXSP $ISNONINSTALLINGPKG $JOBBRANCHNAME $HOTPA +TCHBINARIES $BINARIESAFFECTED $BUGTITLE); $VERSION = '1.00'; my($PACKAGE_REQUEST_ID, $BUGNUMBER, $KBARTICLE, $DISTMETHOD, $MINSP, $ +MAXSP, $ISNONINSTALLINGPKG, $JOBBRANCHNAME, $HOTPATCHBINARIES, $BINAR +IESAFFECTED, $BUGTITLE); BEGIN { print "Begin has begun\n"; $PACKAGE_REQUEST_ID = "PackageRequestID"; $BUGNUMBER = "bugnumber"; $KBARTICLE = "kbarticle"; $DISTMETHOD = "distmethod"; $MINSP = "minsp"; $MAXSP = "maxsp"; $ISNONINSTALLINGPKG = "isnoninstallingpkg"; $JOBBRANCHNAME = "jobbranchname"; $HOTPATCHBINARIES = "hotpathbinaries"; $BINARIESAFFECTED = "binariesaffected"; $BUGTITLE = "bugtitle"; print "PRI is $PACKAGE_REQUEST_ID\n"; }
prints "WHAT VALUE?\n". What am I doing wrong?print "WHAT VALUE? $PACKAGE_REQUEST_ID" . "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Exporting scalars from a module
by leriksen (Curate) on May 03, 2004 at 07:21 UTC | |
by chip (Curate) on May 03, 2004 at 15:32 UTC | |
by Anonymous Monk on Mar 19, 2005 at 01:55 UTC | |
by Tanktalus (Canon) on Mar 19, 2005 at 02:55 UTC |