> Bingo!
Great! =)
You want it on CPAN?
I'm still not sure about the right name for the module(s)
Especially because there are different approaches...
- Should $variables also be lexically exported? Exporter allows this
- prior to 5.22 it's only possible to export refs $_ = \&func; like here. Hence lexical::refs ?
- some wrapped modules (especially pragmas) need to know the calling target module during import, they even bypass exporter.
Shall I prepare a version injecting the use $module and cleansing the namespace afterwards again? lexical::clean ?
| [reply] [d/l] [select] |
Well, maybe the most appropriate Cpan name would be Importer::Lexical? Since Importer exists...
The longer story for the situation that triggered the question is that I was working on changes to CodeGen::Cpppp, and one of my goals for that module is to make it fat-packable, or even just drop it's source code in a scripts/ directory alongside the source code of a project written in C. The idea would be to generate the C files if possible, and then write Makefile rules that let people regenerate the files as long as they have perl-5.20 or newer. (without them knowing anything about perl or how to install perl modules). Cpppp currently needs 5.20 and so now I'm debating whether to up that to 5.22.
Meanwhile, the other reason I wanted to know if there was a way is because I have my own Exporter::Extensible which is currently pure-perl, and can't do lexical exports. Now that I know it's possible without XS, I'd like to add a feature to that so you can say use SomeModuleUsingEE -lexical => 'foo';. This is on my back-burner, but something I'd like to have eventually.
In the grand scheme of things, I think it's probably better to go with an 'Importer' design than an 'Exporter' design, and if I'd found Importer before I wrote Exporter::Extensible I probably would have gone a different direction, focused on making it easy to AUTOLOAD the generated functions so that Importer can find them.
In light of all that, I'll let you decide how best to spend your time :-)
| [reply] [d/l] [select] |
Thanks for pointing me to Importer , didn't know about that one.
I'm puzzled if this shouldn't rather be in the lowercase namespace, since it's very
pragma'ish .
I think I will try to implement the semantics first and delay the name question.
Creating aliases is not too difficult.
| [reply] |