Data::P...::Digest(3)
π Data::Printer::Filter::Digest
okay so bestie, this page lives in the User Contributed Perl Documentation section of the manual, and it's about a lil plugin that makes your digests look gorgeous instead of like a sad wall of hex. It's Data::Printer::Filter::Digest β pretty-printing MD5, SHA and basically every other digest you'd ever touch. π
β¨ NAME β¨
Data::Printer::Filter::Digest β pretty-printing MD5, SHA and many other digests π
πΈ SYNOPSIS πΈ
so first things first, you drop this into your .dataprinter file:
filters = Digest
and if you wanna customize the look and feel (and like, why wouldn't you), there are these options too:
filter_digest.show_class_name = 0
filter_digest.show_reset = 1
# you can even customize your themes:
colors.digest = #27ac3c
That's it! literally that's it. slay. β¨
π¦ DESCRIPTION π¦
This right here is a filter plugin for Data::Printer. What it does is it filters through a bunch of message digest objects and shows you their current value in hexadecimal format, as a string. no cap, that's the whole vibe check. π
π Parsed Modules π
Any module that inherits from Digest::base gets caught by this filter. These ones are the actively supported icons π:
Digest::Adler32Digest::MD2Digest::MD4Digest::MD5Digest::SHADigest::SHA1Digest::Whirlpool
If you've got suggestions for more modules or just, like, better output? please let us know, we're genuinely obsessed with feedback. π«Ά
π Extra Options π
aside from the display color, there are a few other things you can customize through the filter_digest option key:
show_class_nameβ if you set this to true (which is the default, bestie), the class name gets displayed right next to the hexadecimal digest. very "who dis" energy.show_resetβ if this is set to true (also the default), the filter adds a[reset]tag after it dumps an empty digest object. the rationale is down below, keep reading π
π Note on dumping Digest::* objects π
okay this is the important part so pay attention:
The digest operation is effectively a destructive, read-once operation. Once it's been performed, most Digest::* objects are automatically reset, and they can be used to calculate another digest value.
this behaviour β or, rather, forgetting about this behaviour β is a super common source of issues when you're working with Digests. like, extremely common. π
good news tho: this Data::Printer filter will not destroy your object. Instead, we do our work on a cloned version to display the hexdigest, leaving your original object completely untouched. your fave stays safe. π§
And as another debugging convenience for developers β since the empty object will still produce a digest even after being used β this filter adds a [reset] tag by default. That tag tells you the object is empty, sitting in a 'reset' state, i.e. its hexdigest is the same as the hexdigest of a brand-new, empty object of that same class. iconic honesty, honestly. β
π SEE ALSO π
Data::Printer
that's the whole page, bestie β no notes. this one's from perl v5.42.0, dated 2024-01-23, and yeah it's the Data::Printer::Filter::Digest page from the User Contributed Perl Documentation. go forth and pretty-print your digests πβ¨π¦
π¦ where this page comes from
- opensuse-leap 16.0: perl-Data-Printer 1.002001-bp160.1.11 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms