in reply to How to change the symbol table to wrap a sub in another sub ?
As Davido has mentioned, subclassing would be a better approach. On the other hand, if you don't want to do that, then this should work:-
{ no strict 'refs'; no warnings 'redefine'; my $code = \&CGI::param; *{"CGI::param"} = sub { my $ret = &$code(@_); return Encode::decode_utf8($ret); }; }
There are also various modules on the CPAN to do this for you - have a look at Hook::LexWrap and Sub::WrapPackages for starters.
|
|---|