Moose/Connection.pm

filter: Statementstmt 100% 37 / 37 Branchbran n/a Conditioncond 50.0% 3 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 10 / 10 Podpod 100% 1 / 1 totaltotal 87.9% 51 / 58 CC 3 SCAR 3.1
CC
3
Cov
93%
_timeout_arg
2.1
_read_length_arg
2.0
BEGIN
1.0
CRAP 1.4
« Moose/Instrument/RS_ZVA.pm ↑ Summary Moose/Sweep/Step/Repeat.pm »
1 package Lab::Moose::Connection;
2 29 $Lab::Moose::Connection::VERSION = '3.931';
3 #ABSTRACT: Role for connections
4  
5 29 ▶use v5.20;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 29 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 29 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 29 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 29 ▶use MooseX::Params::Validate qw/validated_hash/;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 29 ▶use Lab::Moose::Instrument qw/timeout_param read_length_param/;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 29 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 29 requires qw/Read Write Clear/;
16  
17  
18 29 has timeout => (
19 is => 'ro',
20 isa => 'Num',
21 default => 1,
22 );
23  
24 6 ▶sub _timeout_arg {
Subroutine _timeout_arg: called CC=2 SCAR=7.6
25 6 my $self = shift;
26 6 my %arg = @_;
27 6 ▶ return $arg{timeout} // $self->timeout();
Condition33%1/3
$arg{"timeout"} // $self->timeout
l!l&&r!l&&!r
060
MC/DC0%0/2
$arg{"timeout"} // $self->timeout
$arg{"timeout"} $self->timeout
Truth table33%1/3
A // B
A= $arg{"timeout"}B= $self->timeout
ABresult
1X1
011
000
28 }
29  
30 29 has read_length => (
31 is => 'ro',
32 isa => 'Int',
33 default => 32768
34 );
35  
36 3 ▶sub _read_length_arg {
Subroutine _read_length_arg: called CC=2 SCAR=7.0
37 3 my $self = shift;
38 3 my %arg = @_;
39 3 ▶ return $arg{read_length} // $self->read_length();
Condition66%2/3
$arg{"read_length"} // $self->read_length
l!l&&r!l&&!r
210
MC/DC0%0/2
$arg{"read_length"} // $self->read_length
$arg{"read_length"} $self->read_length
Truth table66%2/3
A // B
A= $arg{"read_length"}B= $self->read_length
ABresult
1X1
011
000
40 }
41  
42  
43 3 ▶sub Query {
Subroutine Query: called CC=1 SCAR=0.0
Pod documented
44 3 my ( $self, %arg ) = validated_hash(
45 \@_,
46 timeout_param,
47 read_length_param,
48 command => { isa => 'Str' },
49 );
50  
51 3 my %write_arg = %arg;
52 3 delete $write_arg{read_length};
53 3 $self->Write(%write_arg);
54  
55 3 delete $arg{command};
56 3 return $self->Read(%arg);
57 }
58  
59 29 1;
60  
61 __END__
« Moose/Instrument/RS_ZVA.pm ↑ Summary Moose/Sweep/Step/Repeat.pm »