If I read that correctly, you might want to check your namespace after importing :all...
The _add_private sub will be called while initializing %EXPORT_TAGS, and it modifies @EXPORT_OK, which is also used to define (by reference) the :all tag. Data::Dumper should illustrate this if asked to dump the %EXPORT_TAGS hash.
If you still want this, I suggest: (untested)
# ... our %EXPORT_TAGS = ( all => [@EXPORT_OK], ); $EXPORT_TAGS{private} = _add_private(); # ...
The %EXPORT_TAGS initialization is split into two statements to ensure a sequence point and avoid a possible undefined evaluation order. This ensures that the initial @EXPORT_OK is copied into a new array before _add_private modifies its contents.
In reply to Re^3: Importing multiple %EXPORT_TAGS
by jcb
in thread Importing multiple %EXPORT_TAGS
by stevieb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |