]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/ContentDigestDbg.pm
content_digest_dbg: convert to arrayref and limit to lei
[public-inbox.git] / lib / PublicInbox / ContentDigestDbg.pm
index 899afbbe6f0ed30a1e5ee5c6a62875f0dc9b0389..5de0ee8ac3eb58d403a3b1bcf24d9920b0e4e4e5 100644 (file)
@@ -1,17 +1,19 @@
 # Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
+# only loaded in lei
 package PublicInbox::ContentDigestDbg; # cf. PublicInbox::ContentDigest
 use v5.12;
 use Data::Dumper;
 use PublicInbox::SHA;
+$Data::Dumper::Useqq = $Data::Dumper::Terse = 1;
 
-sub new { bless { dig => PublicInbox::SHA->new(256), fh => $_[1] }, __PACKAGE__ }
+sub new { bless [ PublicInbox::SHA->new(256), $_[1] ], __PACKAGE__ }
 
 sub add {
-       $_[0]->{dig}->add($_[1]);
-       print { $_[0]->{fh} } Dumper([split(/^/sm, $_[1])]) or die "print $!";
+       $_[0]->[0]->add($_[1]);
+       print { $_[0]->[1] } Dumper([split(/^/sm, $_[1])]) or die "print $!";
 }
 
-sub hexdigest { $_[0]->{dig}->hexdigest; }
+sub hexdigest { $_[0]->[0]->hexdigest }
 
 1;