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 SCAR 11.0
CC
3
Cov
93%
_timeout_arg
2.1
_read_length_arg
2.0
BEGIN
1.0
CRAP 3.0
« Moose/Instrument/RS_ZVA.pm ↑ Summary Moose/Instrument/SCPI/Sense/Function/Concurrent.pm »
1 package Lab::Moose::Connection;
2 29 $Lab::Moose::Connection::VERSION = '3.881';
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 sub _timeout_arg {
25 6 ▶ my $self = shift;
Subroutine _timeout_arg: called CC=2 SCAR=7.6
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 sub _read_length_arg {
37 3 ▶ my $self = shift;
Subroutine _read_length_arg: called CC=2 SCAR=7.0
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 sub Query {
44 3 ▶ my ( $self, %arg ) = validated_hash(
Subroutine Query: called CC=1 SCAR=0.0
Pod documented
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__
62  
63 =pod
64  
65 =encoding UTF-8
66  
67 =head1 NAME
68  
69 Lab::Moose::Connection - Role for connections
70  
71 =head1 VERSION
72  
73 version 3.881
74  
75 =head1 DESCRIPTION
76  
77 This role should be consumed by all connections in the Lab::Moose::Connection
78 namespace. It declares the required methods.
79  
80 =head2 Query
81  
82 my $data = $connection->Query(command => '*IDN?');
83  
84 Call C<Write> followed by C<Read>.
85  
86 =head1 COPYRIGHT AND LICENSE
87  
88 This software is copyright (c) 2023 by the Lab::Measurement team; in detail:
89  
90 Copyright 2016 Simon Reinhardt
91 2017 Andreas K. Huettel, Simon Reinhardt
92 2020 Andreas K. Huettel
93  
94  
95 This is free software; you can redistribute it and/or modify it under
96 the same terms as the Perl 5 programming language system itself.
97  
98 =cut
« Moose/Instrument/RS_ZVA.pm ↑ Summary Moose/Instrument/SCPI/Sense/Function/Concurrent.pm »