SPUG: Overly clever?

Michael R. Wolf MichaelRWolf at att.net
Fri May 21 15:13:15 CDT 2004


Clever, not overly so. IMHO. Mainly, I like that you're putting
complexity *in* the module to assist the consumer of the module,
keeping the complexity out of the calling code.

I've got a few questions...

First, a maintenance point -- since "Whizbang" seems a strange name
(i.e. likely to be changed by someone when you publish it), perhaps a
$package_name scalar could hold that, *and* be used in all the warn
messages.  Change it once, and have all references change.  Constant
refactoring, as Ingy would say.

Second, does this really work, the "next" part, that is? I'd have
expected that the comma would have created a list for warn which
expected a list, and that it wouldn't have worked as a binary sequence
operator as you have shown here. I'll admit that I'm not 100% sure of
how/why the Perl DWIMery on commas works as it does, so any
explanations from the group that could help me frame it would be
appreciated.

> foreach (@EXPORTABLE) {
> 	warn "Unable to export $_ because _$_ is not defined", next
> 	  unless defined &{Whizbang::{"_$_"}};
> 	eval "*$_ = \\&_$_";  # alias _function to function
> }


-- 
Michael R. Wolf
    All mammals learn by playing!
        MichaelRWolf at att.net





More information about the spug-list mailing list