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 :-)


In reply to Re^6: Pure perl lexical sub import (POC) by NERDVANA
in thread Pure perl lexical sub import by NERDVANA

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.