NAME

D - Provides utility functions to encode data and dump it to STDERR.

SYNOPSIS

use utf8;

# Export du and dw functions
use D;

# Reference data that contains decoded strings
my $data = [{name => 'あ'}, {name => 'い'}];

# Encode all strings in reference data to UTF-8 and dump the reference data to STDERR
du $data;

# Encode all strings in reference data to cp932 and dump the reference data.
dw $data;

# Dump reference data to STDERR without encoding.
dn $data;

DESCRIPTION

D module provides utility functions to encode data and dump it to STDERR.

FEATURES

  • Export du and dw and dn functions. Don't conflict debug command such as 'p' because these function names are consist of two characters.

  • Encode all strings in reference data in du and dw function.

  • du is a short name of "dump UTF-8"

  • dw is a short name of "dump Windows cp932"

  • dn is a short name of "dump no encoding"

  • Onliner is useful. "useD;du $data;" or "useD;dw $data;" or "useD;dn $data;"

  • Use Dump method of Data::Dumper to dump data

  • Print line number and file name to STDERR

  • Keys of hash of dumped data is sorted.

  • Don't print "$VAR1 =" unlike Data::Dumper default.

EXPORT

Export du and dw and dn functions.

FUNCTIONS

du

du $data;

Encode all strings in reference data to UTF-8 and dump the reference data to STDERR with file name and line number.

If the argument is not reference data such as a string, it is also dumped in the same way as reference data.

dw

Encode all strings in reference data to cp932 and dump the reference data to STDERR with file name and line number.

If the argument is not reference data such as a string, it is also dumped in the same way as reference data.

dn

Dump reference data to STDERR without encoding with file name and line number.

If the argument is not reference data such as a string, it is also dumped in the same way as reference data.

Bug Report

https://github.com/YoshiyukiItoh/D

SEE ALSO

Data::Dumper, Carp, Data::Recursive::Encode

AUTHOR

yoshiyuki ito, <yoshiyuki.ito.biz@gmail.com>

Yuki Kimoto, <kimoto.yuki@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2019 by yoshi, Yuki Kimoto

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.08.7 or, at your option, any later version of Perl 5 you may have available.