Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Dynamic exports with Exporter::Easy

by Athanasius (Archbishop)
on Oct 22, 2019 at 03:22 UTC ( [id://11107811]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11107811]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (2)
As of 2024-04-19 19:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found