Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- fuzzy on EXPORT in module syntax
August 4, 2015, 12:38 am
rate this thread
What am I missing?
@EXPORT = ();
@EXPORT_OK = qw( NewRev );
Line 8 of the following calls the above
Global symbol "@EXPORT" requires explicit package name
at /home/linuxutil/perl/GetUpdateModules.pm line 8.
Re: fuzzy on EXPORT in module syntax
You have a template to a correct module there in the documentation.
It says something like you need this:
use Exporter ();
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
# set the version for version checking
$VERSION = 1.00;
# if using RCS/CVS, this may be preferred
$VERSION = sprintf "%d.%03d", q$Revision: 1.1 $ =~ /(\d+)/g;
@ISA = qw(Exporter);
@EXPORT = qw(&func1 &func2 &func4);
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
# your exported package globals go here,
# as well as any optionally exported functions
@EXPORT_OK = qw($Var1 %Hashit &func3);
# exported package globals go here
# non-exported package globals go here
# initialize package globals, first exported ones
$Var1 = '';
%Hashit = ();
# then the others (which are still accessible as $Some::Module::stuff)
$stuff = '';
@more = ();
# all file-scoped lexicals must be created before
# the functions below that use them.
The generation of random numbers is too important to be left to chance