Moose/Instrument/SCPI/Source/Level.pm

filter: Statementstmt 100% 28 / 28 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 100% 2 / 2 totaltotal 100% 38 / 38 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Moose/Instrument/SCPI/Source/Function.pm ↑ Summary Moose/Instrument/SCPI/Source/Power.pm »
1 package Lab::Moose::Instrument::SCPI::Source::Level;
2 6 $Lab::Moose::Instrument::SCPI::Source::Level::VERSION = '3.931';
3 #ABSTRACT: Role for the SCPI SOURce:(CURRent|VOLTage):Level commands
4  
5 6 ▶use v5.20;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 6 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 6 ▶use Moose::Util::TypeConstraints 'enum';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 6 ▶use Lab::Moose::Instrument::Cache;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 6 ▶use Lab::Moose::Instrument qw/validated_getter validated_setter/;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 6 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13  
14 6 with 'Lab::Moose::Instrument::SCPI::Source::Function';
15  
16 6 cache source_level => ( getter => 'source_level_query' );
17  
18 25 ▶sub source_level_query {
Subroutine source_level_query: called CC=1 SCAR=0.0
Pod documented
19 25 my ( $self, %args ) = validated_getter( \@_ );
20  
21 25 my $function = $self->cached_source_function();
22  
23 25 return $self->cached_source_level(
24 $self->query( command => "SOUR:$function:LEV?", %args ) );
25 }
26  
27 206 ▶sub source_level {
Subroutine source_level: called CC=1 SCAR=0.0
Pod documented
28 206 my ( $self, $value, %args ) = validated_setter(
29 \@_,
30 value => { isa => 'Num' }
31 );
32  
33 206 my $function = $self->cached_source_function();
34  
35 206 $self->write(
36 command => sprintf( "SOUR:$function:LEV %.15g", $value ),
37 %args
38 );
39 206 $self->cached_source_level($value);
40 }
41  
42 6 1;
43  
44 __END__
« Moose/Instrument/SCPI/Source/Function.pm ↑ Summary Moose/Instrument/SCPI/Source/Power.pm »