VERSION

version 1.0002

NAME

Data::Dumper::AutoEncode::AsDumper - Concise, encoded data dumping with Dumper(), everywhere

SYNOPSIS

use utf8;
use Data::Dumper::AutoEncode::AsDumper;

$data = {
    русский  => 'доверяй, но проверяй',
    i中文    => '也許你的生活很有趣',
    Ελληνικά => 'ἓν οἶδα ὅτι οὐδὲν οἶδα',
};

say 'proverbs', Dumper $data; # output encode to utf8

DESCRIPTION

L<Data::Dumper> decodes data before dumping it, making it unreadable
for humans. This module exports the C<Dumper> function, but the
dumped output is encoded.

EXPORTED FUNCTION

Dumper(LIST)

This module exports one function, Dumper. It works just like the original, except that output is encoded, by default to utf8.

If you want to change the encoding, set the global:

$Data::Dumper::AutoEncode::ENCODING = 'CP932';

WHY USE THIS MODULE?

This package implements a thin wrapper around the excellent module Data::Dumper::AutoEncode. Reasons to use this instead include:

Convenience

If you use this module you can just call Dumper as you normally would if you used Data::Dumper, rather than having to call Data::Dumper::AutoEncode::eDumper. Any existing code will continue to work, with better output.

(Note: You can now obtain the same behaviour by using an import option with Data::Dumper::AutoEncode, but that was not implemented when this module was first released.)

Concision

The following Data::Dumper options are set:

$Data::Dumper::Indent        = 1;
$Data::Dumper::Quotekeys     = 0;
$Data::Dumper::Sortkeys      = 1;
$Data::Dumper::Terse         = 1;
$Data::Dumper::Trailingcomma = 1;
Exports to main package by default

This module uses the excellent Import::Into so that the Dumper function will be imported into the caller's main package, no matter where the module is loaded.

To turn off this behaviour, set the global in a BEGIN block before loading the module:

$Data::Dumper::AutoEncode::AsDumper::NoImportInto = 1;

ACKNOWLEDGEMENTS

Dai Okabayashi (BAYASHI)

Graham Knop (HAARG)

Gurusamy Sarathy (GSAR) ( and Sawyer X (XSAWYERX) )

Slaven Rezić (SREZIC)

CPAN Testers

All the dzil contributors

Athanasius

I stand on the shoulders of giants ...

SEE ALSO

Data::Dumper::AutoEncode, Data::Dumper

AUTHOR

Nick Tonkin <tonkin@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2020 by Nick Tonkin.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.