in reply to Dynamic exports with Exporter::Easy

Hello wanna_code_perl,

Note that use MODULE LIST is equivalent to BEGIN { require MODULE; MODULE->import( LIST ); }; so, if you have:

use Exporter::Easy ( OK => [ keys %subs ], TAGS => all => [ keys %subs ], ], );

the implicit BEGIN block invokes a reference to the %subs hash before it has been initialised. Changing to require works for me (i.e., it passes your test script with either use Foo qw/subA subB Abus Bbus/; or use Foo ':all';):

require Exporter::Easy; Exporter::Easy->import( OK => [ keys %subs ], TAGS => [ all => [ keys %subs ], ], );

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Replies are listed 'Best First'.
Re^2: Dynamic exports with Exporter::Easy
by wanna_code_perl (Friar) on Oct 22, 2019 at 05:53 UTC

    Thanks for the solution, but most of all, for breaking down the use semantics. You could have told me to RTFM and I probably would have figured it out from there, but I appreciate you taking the extra time to tie it back to my specific example.