Moose/Instrument/HP34410A.pm

filter: Statementstmt 80.7% 42 / 52 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 78.5% 11 / 14 Podpod 20.0% 1 / 5 totaltotal 72.0% 54 / 75 CC 3 SCAR 11.6
CC
3
Cov
75%
allowed_ranges
12.0
set_range
2.0
get_cached_range
2.0
CRAP 3.2
« Moose/Sweep/Step/Pulsewidth.pm ↑ Summary Moose/DataFile/Meta.pm »
1 package Lab::Moose::Instrument::HP34410A;
2 2 $Lab::Moose::Instrument::HP34410A::VERSION = '3.931';
3 #ABSTRACT: HP 34410A digital multimeter.
4  
5 2 ▶use v5.20;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7  
8 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use MooseX::Params::Validate;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use Lab::Moose::Instrument qw/validated_getter validated_setter/;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 ▶use Lab::Moose::Instrument::Cache;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 2 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 2 extends 'Lab::Moose::Instrument';
17  
18 2 with qw(
19 Lab::Moose::Instrument::Common
20 Lab::Moose::Instrument::SCPI::Sense::Function
21 Lab::Moose::Instrument::SCPI::Sense::Impedance
22 Lab::Moose::Instrument::SCPI::Sense::NPLC
23 Lab::Moose::Instrument::SCPI::Sense::Null
24 Lab::Moose::Instrument::SCPI::Sense::Range
25 Lab::Moose::Instrument::AdjustRange
26 );
27  
28 1 ▶sub BUILD {
Subroutine BUILD: called CC=1 SCAR=0.0
Pod undocumented
29 1 my $self = shift;
30 1 $self->clear();
31 1 $self->cls();
32 }
33  
34 1 ▶around default_connection_options => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
35 1 my $orig = shift;
36 1 my $self = shift;
37 1 my $options = $self->$orig();
38 1 my $usb_opts = { vid => 0x03f0 }; # what is PID??
39  
40 1 $options->{USB} = $usb_opts;
41 1 $options->{'VISA::USB'} = $usb_opts;
42 1 $options->{'Socket'} = { port => 5025 };
43  
44 1 return $options;
45 2 };
46  
47  
48  
49 1 ▶sub get_value {
Subroutine get_value: called CC=1 SCAR=0.0
Pod documented
50 1 my ( $self, %args ) = validated_getter( \@_ );
51 1 return $self->query( command => ':read?', %args );
52 }
53  
54 ### Required methods of AdjustRange role
55  
56 0 ▶sub allowed_ranges {
Subroutine allowed_ranges: not called CC=3 SCAR=24.8
Pod undocumented
57 0 my $self = shift;
58 0 my $function = $self->cached_sense_function();
59 0 ▶ if ( $function eq 'VOLT' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($function eq 'VOLT') { } 0 0 0
elsif ($function eq 'CURR') { } 0 0 0
60 0 return [ 0.1, 1, 10, 100, 1000 ];
61 }
62 elsif ( $function eq 'CURR' ) {
63 0 return [ 1e-4, 1e-3, 1e-2, 1e-1, 1, 3 ];
64 }
65 else {
66 0 croak "function $function not yet supported";
67 }
68 }
69  
70 0 ▶sub set_range {
Subroutine set_range: not called CC=1 SCAR=6.9
Pod undocumented
71 0 my $self = shift;
72 0 return $self->sense_range(@_);
73 }
74  
75 0 ▶sub get_cached_range {
Subroutine get_cached_range: not called CC=1 SCAR=6.9
Pod undocumented
76 0 my $self = shift;
77 0 return $self->cached_sense_range(@_);
78 }
79  
80 2 __PACKAGE__->meta()->make_immutable();
81  
82 2 1;
83  
84 __END__
« Moose/Sweep/Step/Pulsewidth.pm ↑ Summary Moose/DataFile/Meta.pm »