|There's more than one way to do things|
Re: Redefining Imported Subs: of scope and noby LanX (Canon)
|on Feb 09, 2013 at 02:22 UTC||Need Help??|
(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.