Skip to content

Instantly share code, notes, and snippets.

@akzhan
Created July 5, 2016 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akzhan/93113ff2a6d8420c7ff6b4bcd023085c to your computer and use it in GitHub Desktop.
Save akzhan/93113ff2a6d8420c7ff6b4bcd023085c to your computer and use it in GitHub Desktop.
HashRefInflator that knows about utf8
package BUX::DB::HashRefInflator;
use strict;
use warnings;
use utf8;
use parent qw( DBIx::Class::ResultClass::HashRefInflator );
sub inflate_result {
my ( $self, @args ) = @_;
my $res = $self->SUPER::inflate_result( @args );
$res = {
map {
my $val = $res->{$_};
utf8::decode($val) if defined $val && !ref($val);
( $_ => $val );
} keys %$res
} if ref($res) eq 'HASH';
return $res;
}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment