in reply to How to change the symbol table to wrap a sub in another sub ?
Why not just subclass CGI?
If you don't want to do that, then I recommend the following:
# Must appear before "use CGI". BEGIN { require CGI; package CGI; no warnings 'redefine'; my $real_param = \&CGI::param; sub param { if (wantarray) { return map { Encode::decode_utf8($_) } $real_param->(@_); } else { return Encode::decode_utf8($real_param->(@_)); } } }
My version fixes two bugs.
Updated to work in list context.
|
|---|