It's really backwards having to turn off warnings to just add something to the current namespace without having to turn off warnings and hack around it
Nowhere in this thread are warnings turned off, so I'm not sure what you mean. If you mean strict, then yes, turning off strict 'refs' is necessary when doing this kind of exporting/importing with strict enabled. More specifically, it's required because the second method I showed uses Symbolic references to build the names of the symbols from strings. Exporter does it internally too.
Can I change a sub declaration to force it to assign the sub to the same sub in the current namespace like the hash? Using the experimental 'lexical_subs' works for what I expect.
The code I showed copies a reference to a sub from one symbol table to another, which is how importing/exporting works in Perl. As I said, have a look at perlmod, or perhaps my post here (the paragraph beginning with "Once you understand...", the first two bullet points, and the "Update").
Other than that I'm not sure I understand your expectations, especially in reference to Lexical Subroutines. Maybe you could show with code what you are expecting to be able to do?
considering that variables are exported in a sensible way, but the functions aren't,
Yes, I think it's a limitation in Device::BCM2835 that it does not export its functions, and IMO one that might be worth a request to the module's author to see if they might add that. But as long as they don't, and you don't want to patch the module either (as you said), you'll have to work around it, for example with the code I showed.
warnings/strict are useless
Sorry, I don't understand this point. If you mean the no strict 'refs';, then its effect is limited to its lexical scope, which is why I put it inside the loop, so that it does not affect the rest of the program.
In reply to Re^7: Export and use different package in module
by haukex
in thread Export and use different package in module
by chenhonkhonk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |