1Data::Printer::Filter::UDsiegresCto(n3t)ributed Perl DocDuamtean:t:aPtriionnter::Filter::Digest(3)
2
3
4
6 Data::Printer::Filter::Digest - pretty-printing MD5, SHA and friends
7
9 In your program:
10
11 use Data::Printer filters => {
12 -external => [ 'Digest' ],
13 };
14
15 or, in your ".dataprinter" file:
16
17 {
18 filters => {
19 -external => [ 'Digest' ],
20 },
21 };
22
23 You can also setup color and display details:
24
25 use Data::Printer
26 filters => {
27 -external => [ 'Digest' ],
28 },
29 color => {
30 digest => 'bright_green',
31 }
32 digest => {
33 show_class_name => 0, # default.
34 show_reset => 1, # default.
35 },
36 };
37
39 This is a filter plugin for Data::Printer. It filters through several
40 digest classes and displays their current value in hexadecimal format
41 as a string.
42
43 Parsed Modules
44 · Digest::Adler32
45
46 · Digest::MD2
47
48 · Digest::MD4
49
50 · Digest::MD5
51
52 · Digest::SHA
53
54 · Digest::SHA1
55
56 · Digest::Whirlpool
57
58 If you have any suggestions for more modules or better output, please
59 let us know.
60
61 Extra Options
62 Aside from the display color, there are a few other options to be
63 customized via the "digest" option key:
64
65 show_class_name
66
67 Set this to true to display the class name right next to the
68 hexadecimal digest. Default is 0 (false).
69
70 show_reset
71
72 If set to true (the default), the filter will add a "[reset]" tag after
73 dumping an empty digest object. See the rationale below.
74
75 Note on dumping Digest::* objects
76 The digest operation is effectively a destructive, read-once operation.
77 Once it has been performed, most Digest::* objects are automatically
78 reset and can be used to calculate another digest value.
79
80 This behaviour - or, rather, forgetting about this behaviour - is a
81 common source of issues when working with Digests.
82
83 This Data::Printer filter will not destroy your object. Instead, we
84 work on a cloned version to display the hexdigest, leaving your
85 original object untouched.
86
87 As another debugging convenience for developers, since the empty object
88 will produce a digest even after being used, this filter adds by
89 default a "[reset]" tag to indicate that the object is empty, in a
90 'reset' state - i.e. its hexdigest is the same as the hexdigest of a
91 new, empty object of that same class.
92
94 Data::Printer
95
96
97
98perl v5.30.1 2020-01-29 Data::Printer::Filter::Digest(3)