Data-Dumper-AutoEncode
view release on metacpan or search on metacpan
lib/Data/Dumper/AutoEncode.pm view on Meta::CPAN
This is not human-readable.
Data::Dumper::AutoEncode exports `eDumper` function. You can use it.
use utf8;
use Data::Dumper::AutoEncode;
my $foo = +{ foo => 'ãã§ã' };
print eDumper($foo);
# { foo => "ãã§ã" }
Also `Dumper` function is exported from Data::Dumper::AutoEncode. It is same as Data::Dumper::Dumper
=head1 METHOD
By default, both functions B<eDumper> and B<Dumper> will be exported.
=over
=item eDumper(LIST)
Dump with recursive encoding(default: utf8)
If you want to encode other encoding, set encoding to $Data::Dumper::AutoEncode::ENCODING.
$Data::Dumper::AutoEncode::ENCODING = 'CP932';
=item Dumper(LIST)
Same as the C<Dumper> function of L<Data::Dumper>. However, if you specify an import option C<-dumper>, then the C<Dumper> function will work as same as C<eDumper> function. Please see C<IMPORT OPTIONS> section for more details.
=item encode($encoding, $stuff)
Just encode stuff.
=back
=head1 IMPORT OPTIONS
You can specify an import option to override C<Dumper> function.
use Data::Dumper::AutoEncode '-dumper';
It means C<Dumper> function is overrided as same as eDumper.
=head1 GLOBAL VARIABLE OPTIONS
=head2 ENCODING : utf8
Set this option if you need another encoding;
=head2 BEFORE_HOOK / AFTER_HOOK
Set code ref for hooks which excuted around encoding
$Data::Dumper::AutoEncode::BEFORE_HOOK = sub {
my $value = $_[0]; # decoded
$value =~ s/\x{2019}/'/g;
return $value;
};
$Data::Dumper::AutoEncode::AFTER_HOOK = sub {
my $value = $_[0]; # encoded
// do something
return $value;
};
=head2 CHECK_ALREADY_ENCODED : false
If you set this option true value, check a target before encoding. And do encode in case of decoded value.
=head2 DO_NOT_PROCESS_NUMERIC_VALUE : true
By default, numeric values are ignored (do nothing).
=head2 FLAG_STR
Additional string (prefix) for encoded values.
=head1 HOW TO SET CONFIGURATION VARIABLES TO DUMP
This C<Data::Dumper::AutoEncode> is using L<Data::Dumper> internally. So, you can set configuration variables to dump as the variables of Data::Dumper, like below.
use Data::Dumper::AutoEncode;
local $Data::Dumper::Indent = 2;
local $Data::Dumper::Sortkeys = 1;
local $Data::Dumper::Deparse = 1;
say eDumper($hash);
=head1 REPOSITORY
Data::Dumper::AutoEncode is hosted on github
L<http://github.com/bayashi/Data-Dumper-AutoEncode>
=head1 AUTHOR
Dai Okabayashi E<lt>bayashi@cpan.orgE<gt>
=head1 SEE ALSO
L<Data::Dumper>
=head1 THANKS
gfx
tomyhero
=head1 LICENSE
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. See L<perlartistic>.
=cut
( run in 1.979 second using v1.01-cache-2.11-cpan-140bd7fdf52 )