Problems? Is your data what you think it is? | |
PerlMonks |
Re: Redefining Imported Subs: of scope and noby LanX (Saint) |
on Feb 09, 2013 at 02:22 UTC ( [id://1017918]=note: print w/replies, xml ) | Need Help?? |
Long read! (wont try it again! ;-) I don't understand why you're using feature qw(say) if you wanna redefine 'say. This makes say() a builtin which has to be overridden like described in perlsub#Overriding Built in Functions. Otherwise this works:
or even simpler:
OTOH you will certainly have problems if someone manages to globally switch say on. My suggestion is to replace say() with something like 'log()' or 'out()' and keep it simple, don't redefine the sub at all, just put the test condition into the function body.
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|