blib/lib/LWP/Protocol/Patch/CountBytesIn.pm

filter: Statementstmt 68.2% 28 / 41 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 8 / 12 Podpod 0.0% 0 / 1 totaltotal 66.6% 36 / 54 CC 2 SCAR 4.5
CC
2
Cov
68%
_get_byte_size
3.2
_wrap_collect
2.0
__ANON__
2.0
CRAP 1.6
↑ Summary
1 package LWP::Protocol::Patch::CountBytesIn;
2  
3 1 our $DATE = '2019-10-05'; # DATE
4 1 our $VERSION = '0.001'; # VERSION
5  
6 1 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use strict 'subs', 'vars';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶no warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Log::ger;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶use Module::Patch ();
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use base qw(Module::Patch);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 ▶use Scalar::Util qw(refaddr);
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 our %config;
17 1 our $bytes_in = 0;
18  
19 0 ▶sub _get_byte_size {
Subroutine _get_byte_size: not called CC=2 SCAR=11.6
20 0 my($self, @strings) = @_;
21 0 my $bytes = 0;
22  
23 {
24 0 ▶ use bytes;
Subroutine BEGIN: called CC=1 SCAR=0.2
25 0 for my $string (@strings) {
26 0 $bytes += length($string);
27 }
28 }
29  
30 0 return $bytes;
31 }
32  
33 0 ▶sub _wrap_collect {
Subroutine _wrap_collect: not called CC=1 SCAR=6.9
34 0 my $ctx = shift;
35  
36 0 my ($self, $arg, $response, $collector) = @_;
37  
38 0 push @{ $response->{handlers}{response_data} }, {
39 0 ▶ callback => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
40 0 $bytes_in += _get_byte_size(__PACKAGE__, $_[3]);
41 },
42 0 };
43  
44 0 $ctx->{orig}->(@_);
45 }
46  
47 0 ▶sub patch_data {
Subroutine patch_data: not called CC=1 SCAR=6.9
Pod undocumented
48 return {
49 0 v => 3,
50 config => {
51 },
52 patches => [
53 {
54 action => 'wrap',
55 #mod_version => qr/^6\./,
56 sub_name => 'collect',
57 code => \&_wrap_collect,
58 },
59 ],
60 };
61 }
62  
63 1 1;
64 # ABSTRACT: Count bytes in
65  
66 __END__
↑ Summary