The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

use 5.14.0;
use Moo;
my %counter;
sub _log_generic {
my ($self, $type, $thing) = @_;
my $i = $counter{$type}++;
$self->write("=== BEGIN \U$type\E $$.$i ===\n");
$self->write( $thing->as_string );
$self->write("=== END \U$type\E $$.$i ===\n");
return;
}
for my $which (qw(jmap misc upload download)) {
for my $what (qw(request response)) {
my $method = "log_${which}_${what}";
no strict 'refs';
*$method = sub {
my ($self, $arg) = @_;
$self->_log_generic("$which $what", $arg->{"http_$what"});
}
}
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
JMAP::Tester::Logger::HTTP
=head1 VERSION
version 0.101
=head1 AUTHOR
Ricardo SIGNES <rjbs@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2016 by FastMail, Ltd.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut