]> Sergey Matveev's repositories - public-inbox.git/blob - lib/PublicInbox/ContentDigestDbg.pm
hoist MailDiff and ContentDigestDbg out of lei
[public-inbox.git] / lib / PublicInbox / ContentDigestDbg.pm
1 # Copyright (C) all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
3 package PublicInbox::ContentDigestDbg; # cf. PublicInbox::ContentDigest
4 use v5.12;
5 use Data::Dumper;
6 use Digest::SHA;
7
8 sub new { bless { dig => Digest::SHA->new(256), fh => $_[1] }, __PACKAGE__ }
9
10 sub add {
11         $_[0]->{dig}->add($_[1]);
12         print { $_[0]->{fh} } Dumper([split(/^/sm, $_[1])]) or die "print $!";
13 }
14
15 sub hexdigest { $_[0]->{dig}->hexdigest; }
16
17 1;