I have created a couple of EXPORT_TAGS within my module as below,
package My::Module;
use strict;
use warnings;
require Exporter;
our @ISA = qw ( Exporter );
our %EXPORT_TAGS = (
'set1' => [
qw(
&func1
&func2
)
],
'set2' => [
qw(
$var1
$var2
)
],
'set3' => [
qw(
&sub3
&sub4
)
]
);
# remaining module code
I am now trying to declare the exportable symbols within the EXPORT and EXPORT_OK arrays by simply giving the export tags, instead of specifying each one individually,
our @EXPORT = $EXPORT_TAGS { 'set2' };
our @EXPORT_OK = (
$EXPORT_TAGS { 'set1' },
$EXPORT_TAGS { 'set3' }
);
In my target script, I am invoking my module as below,
use My::Module qw ( :set1 :set3 );
The module compiles without errors. However, the target script doesn't and I receive the following error when I try to use the variables/function belonging to the module,
Global symbol "$var1"
requires explicit package name`
What am I missing/overlooking? Thanks for the help.