Think about Loose Coupling | |
PerlMonks |
Problems with importing (and overriding) functionsby CheeseLord (Deacon) |
on Aug 27, 2001 at 14:06 UTC ( [id://108087]=perlquestion: print w/replies, xml ) | Need Help?? |
CheeseLord has asked for the wisdom of the Perl Monks concerning the following question: As I talked about here, I wrote a quick module to accomplish my desired function of having operators work on the variable itself if called in void context. And it worked well enough for the unary operators, but then damian1301 gave me the idea to extend the module's capabilities to working with map and grep. And I've actually got those working fairly well, too, but with a small problem: I can't import them properly. I imagine it may have to do with the nature of the functions I'm messing with, or my inexperience with the things I'm playing with, but whatever it is, I don't understand it. Here's a boiled-down version of the module that still suffers from the same problem:
And here's my test program:
And my output:
Without specifying the package name, it doesn't work. Were I to add one of the unary ops, though (say, uc), it would. This makes no sense to me, but then again, many things in life don't. So I ask you all - what's going on here? And how can I get this to work the way I want to? Or can I? His Royal Cheeziness
Back to
Seekers of Perl Wisdom
|
|