summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
e6aa13b)
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.
# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
package PublicInbox::ContentDigestDbg; # cf. PublicInbox::ContentDigest
use v5.12;
use Data::Dumper;
use PublicInbox::SHA;
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__ }
- $_[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 }
use v5.12;
use File::Temp 0.19 (); # 0.19 for ->newdir
use PublicInbox::ContentHash qw(content_digest);
use v5.12;
use File::Temp 0.19 (); # 0.19 for ->newdir
use PublicInbox::ContentHash qw(content_digest);
-use PublicInbox::ContentDigestDbg;
-use Data::Dumper ();
use PublicInbox::MsgIter qw(msg_part_text);
use PublicInbox::ViewDiff qw(flush_diff);
use PublicInbox::GitAsyncCat;
use PublicInbox::MsgIter qw(msg_part_text);
use PublicInbox::ViewDiff qw(flush_diff);
use PublicInbox::GitAsyncCat;
$eml->each_part(\&write_part, $self);
return if $self->{ctx}; # don't need content_digest noise in WWW UI
$eml->each_part(\&write_part, $self);
return if $self->{ctx}; # don't need content_digest noise in WWW UI
+ require PublicInbox::ContentDigestDbg;
# XXX is this even useful? perhaps hide it behind a CLI switch
open my $fh, '>', "$dir/content_digest" or die "open: $!";
my $dig = PublicInbox::ContentDigestDbg->new($fh);
# XXX is this even useful? perhaps hide it behind a CLI switch
open my $fh, '>', "$dir/content_digest" or die "open: $!";
my $dig = PublicInbox::ContentDigestDbg->new($fh);
- local $Data::Dumper::Useqq = 1;
- local $Data::Dumper::Terse = 1;
content_digest($eml, $dig);
print $fh "\n", $dig->hexdigest, "\n" or die "print $!";
close $fh or die "close: $!";
content_digest($eml, $dig);
print $fh "\n", $dig->hexdigest, "\n" or die "print $!";
close $fh or die "close: $!";