diff options
author | Eric Wong <e@80x24.org> | 2023-01-29 10:30:42 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-01-30 06:42:32 +0000 |
commit | 859cafe15f4c6055f7944ae4ad2d0560c8249755 (patch) | |
tree | 5b4323f9fb762ec727dfcf4100e9bb9e5208f2c0 /lib/PublicInbox/ContentDigestDbg.pm | |
parent | e6aa13bccb7ea5d5b3246b3a944621515905e360 (diff) | |
download | public-inbox-859cafe15f4c6055f7944ae4ad2d0560c8249755.tar.gz |
Since it's an extremely small class and not subclassed or anything, we'll make it even smaller as an arrayref. We also don't load this for PublicInbox::WWW or anything that runs in public-facing daemons.
Diffstat (limited to 'lib/PublicInbox/ContentDigestDbg.pm')
-rw-r--r-- | lib/PublicInbox/ContentDigestDbg.pm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/PublicInbox/ContentDigestDbg.pm b/lib/PublicInbox/ContentDigestDbg.pm index 899afbbe..5de0ee8a 100644 --- a/lib/PublicInbox/ContentDigestDbg.pm +++ b/lib/PublicInbox/ContentDigestDbg.pm @@ -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; |