steves has asked for the wisdom of the Perl Monks concerning the following question:
I set up a simple UNIVERSAL::VERSION method that allows me to search for an alternate versioned module ( e.g., one under development) instead of bailing out if the version number is too high. This works but not as cleanly as I'd like: I pull in the found module and the original. Is there any clean way to stop compilation of a given module without affecting the rest of the compile/run?
Related to this, I considered writing a true no by implementing a UNIVERSAL::unimport method that "unpollutes" the using module's namespace by removing aliased symbol table references. But it seems you can't undefine these. I tried code like this:but that gives me the error:undef *{"${caller}::{$sym}"}{CODE};
Can't modify glob elem in undef operator
I saw code in the Monastary that claimed to do it like this:But this doesn't seem correct to me -- they're undefining the function, not the symbol table reference to it, right? That seems supported by the different error I get:undef &{*{"${caller}::{$sym}"}{CODE}};
Unable to create sub named ""
A note in Advanced Perl Programming seems to indicate that you can't undo aliased symbol table names -- only use local so they revert back to their old values automagically. But I can't force a local here since the no is an optional, separate piece from the use .
Any ideas? I haven't found anything yet I can't do somehow in Perl, but this one has me stumped.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: version based compilation
by robin (Chaplain) on Dec 29, 2001 at 20:32 UTC | |
by steves (Curate) on Dec 29, 2001 at 21:24 UTC | |
by robin (Chaplain) on Dec 30, 2001 at 04:19 UTC | |
by steves (Curate) on Dec 30, 2001 at 04:47 UTC | |
|
Re: version based compilation
by chromatic (Archbishop) on Dec 29, 2001 at 23:56 UTC | |
by steves (Curate) on Dec 30, 2001 at 00:32 UTC | |
|
Re (tilly) 1: version based compilation
by tilly (Archbishop) on Jan 05, 2002 at 23:34 UTC |