Moose/Connection/VISA/USB.pm untested

filter: Statementstmt 0.0% 0 / 32 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 43 CC 3 SCAR 17.5
CC
3
Cov
0%
gen_resource_name
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 5.8
1 package Lab::Moose::Connection::VISA::USB;
2 $Lab::Moose::Connection::VISA::USB::VERSION = '3.931';
3 #ABSTRACT: USB-TMC frontend to National Instruments' VISA library.
4  
5 use v5.20;
6  
7  
8  
9 use Moose;
10 use Moose::Util::TypeConstraints qw(enum);
11  
12 use Carp;
13  
14 use namespace::autoclean;
15  
16 extends 'Lab::Moose::Connection::VISA';
17  
18 has vid => (
19 is => 'ro',
20 isa => 'Str',
21 required => 1
22 );
23  
24 has pid => (
25 is => 'ro',
26 isa => 'Str',
27 required => 1
28 );
29  
30 has serial => (
31 is => 'ro',
32 isa => 'Str',
33 required => 1
34 );
35  
36 has '+resource_name' => (
37 required => 0,
38 );
39  
40 sub gen_resource_name {
41 my $self = shift;
42  
43 my $vid = $self->vid;
44 my $pid = $self->pid;
45 my $serial = $self->serial;
46 if ( $vid =~ /^0x/i ) {
47 $vid = hex($vid);
48 }
49 if ( $pid =~ /^0x/i ) {
50 $pid = hex($pid);
51 }
52  
53 return sprintf( "USB::0x%04x::0x%04x::%s::INSTR", $vid, $pid, $serial );
54 }
55  
56 __PACKAGE__->meta->make_immutable();
57  
58 1;
59  
60 __END__