in reply to Encode::decode_utf8 and references

use strict; no warnings 'redefine'; use Encode; use Data::Dumper; our $REAL; BEGIN { $REAL = \&Encode::decode_utf8; } sub Encode::decode_utf8 ($;$) { my $hash = shift; for (keys %{$hash}) { $hash->{$_} = $REAL->($hash->{$_}) } return $hash; } my $ref = Encode::decode_utf8({ foo => 1}); print Dumper($ref);

Replies are listed 'Best First'.
Re^2: Encode::decode_utf8 and references
by samtregar (Abbot) on Jun 17, 2006 at 21:54 UTC
    Mmmm, yeah, that might work. Of course I'd have to deal with the more common case where the value passed isn't a hash-ref.

    -sam