Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.
Last night, in working with Devel::Recreate (suggest a better module name, please!), I discovered that it's devilishly difficult to differentiate between use and require or capture import lists. After discussions with Andy Armstrong, the only thing I could think of is either coderefs in @INC or overriding *CORE::GLOBAL::require. I can't tell if either solution allows me to differentiate between the use and require. The only thing I could think of is that use is basically this:
BEGIN { require Module; import Module LIST; }
In other words, if require is triggered, I could use HookLexWrap to wrap the import statement (considering inheritance, of course) to fetch the import list. I'd also have to write some XS code to try and grab PL_beginav to find out if the require happened in the BEGIN phase. Thus, the following would be considered a use statement:
BEGIN {
require Some::Module;
Some::Module->import(@args);
}
Naturally, this is all very rickety. Is there a better way to do this?
Naming (Score:1)
First of all, “
Devel::” is reserved for things to be loaded usingperl’s-dflag. (It should have been a more specific namespace, really, so people wouldn’t be tempted to dump random junk in there that has nothing to do with-d, maybeDB::Custom::or something.)Also, “
Devel::Recreate” gives no indication whatsoever about what it recreates. That would be a package, which suggests that the right TLNS for your module is “Package::”.Now, what does it do with a
Re: (Score:2)
I knew I could count on you to smack me around. Thanks :)
Re: (Score:1)
Oh dear, on re-read, that comment sounds a little more vigorous than I intended. :-) Sorry. Wasn’t meant to be slap-around. I know most people find naming much harder and more tedious than I do.
Re: (Score:2)
Aristotle, I was kidding and I took no issue with what you had to say :)
Re: (Score:2)
Then again, it isn't the opcodes, at least from my weak grasp of the internals, is it?
Re: (Score:2)
Nope. Not trying to dump opcodes, though I may be forced to dig into them at some point. Just trying to dump what perl thinks the source code looks like.
Re: Solving the wrong problem? (Score:1)
To really do it right, I think you end up source filtering (PPI?) everything (unshift(@INC, sub {...})) into s-expressions or something. I've always wished perl were more introspective, but it seems like syntax is the enemy of introspection (and I really like syntax,