line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Dumper::AutoEncode::AsDumper; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '1.0002'; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
720
|
use strict; use warnings; use utf8; |
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
1
|
|
28
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
|
1
|
|
|
|
|
595
|
|
|
1
|
|
|
|
|
15
|
|
|
1
|
|
|
|
|
39
|
|
6
|
1
|
|
|
1
|
|
500
|
use Import::Into; |
|
1
|
|
|
|
|
2756
|
|
|
1
|
|
|
|
|
29
|
|
7
|
1
|
|
|
1
|
|
491
|
use Data::Dumper::AutoEncode (); |
|
1
|
|
|
|
|
19455
|
|
|
1
|
|
|
|
|
51
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$Data::Dumper::Indent = 1; |
10
|
|
|
|
|
|
|
$Data::Dumper::Quotekeys = 0; |
11
|
|
|
|
|
|
|
$Data::Dumper::Sortkeys = 1; |
12
|
|
|
|
|
|
|
$Data::Dumper::Terse = 1; |
13
|
|
|
|
|
|
|
$Data::Dumper::Trailingcomma = 1; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
461
|
use parent 'Exporter'; |
|
1
|
|
|
|
|
335
|
|
|
1
|
|
|
|
|
7
|
|
16
|
|
|
|
|
|
|
our @EXPORT = 'Dumper'; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
0
|
1
|
|
sub Dumper { goto &Data::Dumper::AutoEncode::eDumper } |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
__PACKAGE__->import::into('main') |
21
|
|
|
|
|
|
|
unless $Data::Dumper::AutoEncode::AsDumper::NoImportInto; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
1; # return true |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
__END__ |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=pod |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 VERSION |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
version 1.0002 |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=encoding utf8 |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 NAME |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Data::Dumper::AutoEncode::AsDumper - Concise, encoded data dumping with Dumper(), everywhere |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 SYNOPSIS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
use utf8; |
42
|
|
|
|
|
|
|
use Data::Dumper::AutoEncode::AsDumper; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
$data = { |
45
|
|
|
|
|
|
|
ÑÑÑÑкий => 'довеÑÑй, но пÑовеÑÑй', |
46
|
|
|
|
|
|
|
iä¸æ => 'ä¹è¨±ä½ ççæ´»å¾æ趣', |
47
|
|
|
|
|
|
|
Îλληνικά => 'á¼Î½ οἶδα á½
Ïι οá½Î´á½²Î½ οἶδα', |
48
|
|
|
|
|
|
|
}; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
say 'proverbs', Dumper $data; # output encode to utf8 |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 DESCRIPTION |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
L<Data::Dumper> decodes data before dumping it, making it unreadable |
55
|
|
|
|
|
|
|
for humans. This module exports the C<Dumper> function, but the |
56
|
|
|
|
|
|
|
dumped output is encoded. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 EXPORTED FUNCTION |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=over |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item B<Dumper(LIST)> |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
This module exports one function, C<Dumper>. It works just like the |
65
|
|
|
|
|
|
|
original, except that output is encoded, by default to C<utf8>. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
If you want to change the encoding, set the global: |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
$Data::Dumper::AutoEncode::ENCODING = 'CP932'; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=back |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 WHY USE THIS MODULE? |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
This package implements a thin wrapper around the excellent module |
76
|
|
|
|
|
|
|
L<Data::Dumper::AutoEncode>. Reasons to use this instead include: |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=over |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item B<Convenience> |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
If you use this module you can just call C<Dumper> as you normally |
83
|
|
|
|
|
|
|
would if you used L<Data::Dumper>, rather than having to call |
84
|
|
|
|
|
|
|
L<Data::Dumper::AutoEncode::eDumper|Data::Dumper::AutoEncode/METHOD>. |
85
|
|
|
|
|
|
|
Any existing code will continue to work, with better output. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
I<(Note: You can now obtain the same behaviour by using an import |
88
|
|
|
|
|
|
|
option with L<Data::Dumper::AutoEncode>, but that was not implemented |
89
|
|
|
|
|
|
|
when this module was first released.)> |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item B<Concision> |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
The following C<Data::Dumper> options are set: |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
$Data::Dumper::Indent = 1; |
96
|
|
|
|
|
|
|
$Data::Dumper::Quotekeys = 0; |
97
|
|
|
|
|
|
|
$Data::Dumper::Sortkeys = 1; |
98
|
|
|
|
|
|
|
$Data::Dumper::Terse = 1; |
99
|
|
|
|
|
|
|
$Data::Dumper::Trailingcomma = 1; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=item B<Exports to main package by default> |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
This module uses the excellent L<Import::Into> so that the C<Dumper> |
104
|
|
|
|
|
|
|
function will be imported into the caller's C<main> package, no matter |
105
|
|
|
|
|
|
|
where the module is loaded. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
To turn off this behaviour, set the global in a C<BEGIN> block before |
108
|
|
|
|
|
|
|
loading the module: |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
$Data::Dumper::AutoEncode::AsDumper::NoImportInto = 1; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=back |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Dai Okabayashi (L<BAYASHI|https://metacpan.org/author/BAYASHI>) |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Graham Knop (L<HAARG|https://metacpan.org/author/HAARG>) |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Gurusamy Sarathy (L<GSAR|https://metacpan.org/author/GSAR>) ( and Sawyer X (L<XSAWYERX|https://metacpan.org/author/XSAWYERX>) ) |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Slaven ReziÄ (L<SREZIC|https://metacpan.org/author/SREZIC>) |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
L<CPAN Testers|http://cpantesters.org/> |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
L<All the dzil contributors|http://dzil.org/> |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
L<Athanasius|https://perlmonks.org/?node=Athanasius> |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
I stand on the shoulders of giants ... |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 SEE ALSO |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
L<Data::Dumper::AutoEncode>, L<Data::Dumper> |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 AUTHOR |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Nick Tonkin <tonkin@cpan.org> |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
This software is copyright (c) 2020 by Nick Tonkin. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
145
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=cut |