Hey all, I hope you've all had/are having a wonderful holiday!
I'm having a Rubber Duck Debugging moment here... I am using @EXPORT_OK to export my public functions within a module, and all are available through an :all tag, but for my test suite, I want to have an extra tag that exports a few of my private functions as well, but can't seem to be able to import them. Here's what I've got:
Module:
package MyPackage; use strict; use warnings; use Exporter qw(import); our @ISA = qw(Exporter); our @EXPORT_OK = qw( func_one func_two ); our @EXPORT_PRIVATE = qw( _private_one _private_two ); our %EXPORT_TAGS = ( all => \@EXPORT_OK, private => \@EXPORT_PRIVATE, )
Test script:
use warnings; use strict; use MyPackage qw(:all :private); ...
When I run the script, I get:
"_private_one" is not exported by the MyModule module "_private_two" is not exported by the MyModule module Can't continue after import errors at ... line .... BEGIN failed--compilation aborted at ... line ...
I *thought* I'd done this before, but it turns out although I have other modules that have multiple tags, I've only ever tried to import one at a time, not multiple at once.
I'm sure I'm just having a brain fart moment here. Could someone please point out what I'm missing, or is this importing of multiple tags something that isn't available and I'm just finding out now?
Cheers,
-stevieb
Update: I just thought of something... I suppose I could insert the @EXPORT_OK array into the @EXPORT_PRIVATE one and then simply import the :private tag by itself, but now I'm curious as to whether that's the only way forward or not.
In reply to Importing multiple %EXPORT_TAGS by stevieb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |