XPRESS/Sweep/Power.pm untested

filter: Statementstmt 0.0% 0 / 47 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 7 totaltotal 0.0% 0 / 74 CC 3 SCAR 14.6
CC
3
Cov
0%
exit_loop
12.0
new
2.0
go_to_sweep_start
2.0
CRAP 4.3
1 package Lab::XPRESS::Sweep::Power;
2 #ABSTRACT: Signal generator power sweep
3 $Lab::XPRESS::Sweep::Power::VERSION = '3.899';
4 use v5.20;
5  
6 use Lab::XPRESS::Sweep;
7 use Time::HiRes qw/usleep/, qw/time/;
8 use strict;
9  
10 our @ISA = ('Lab::XPRESS::Sweep');
11  
12 sub new {
13 my $proto = shift;
14 my @args = @_;
15 my $class = ref($proto) || $proto;
16 my $self->{default_config} = {
17 id => 'Power_Sweep',
18 filename_extension => 'POW=',
19 interval => 1,
20 points => [],
21 rate => [1],
22 mode => 'step',
23 allowed_instruments => [
24 'Lab::Instrument::HP83732A', 'Lab::Instrument::MG369xB',
25 'Lab::Instrument::RSSMB100A'
26 ],
27 allowed_sweep_modes => [ 'list', 'step' ],
28 number_of_points => [undef]
29 };
30  
31 $self = $class->SUPER::new( $self->{default_config}, @args );
32 bless( $self, $class );
33  
34 return $self;
35 }
36  
37 sub go_to_sweep_start {
38 my $self = shift;
39  
40 # go to start:
41 $self->{config}->{instrument}
42 ->set_power( { value => @{ $self->{config}->{points} }[0] } );
43 }
44  
45 sub start_continuous_sweep {
46 my $self = shift;
47  
48 return;
49  
50 }
51  
52 sub go_to_next_step {
53 my $self = shift;
54  
55 $self->{config}->{instrument}->set_power(
56 { value => @{ $self->{config}->{points} }[ $self->{iterator} ] } );
57  
58 }
59  
60 sub exit_loop {
61 my $self = shift;
62  
63 if ( $self->{config}->{mode} =~ /step|list/ ) {
64 if (
65 not
66 defined @{ $self->{config}->{points} }[ $self->{iterator} + 1 ] )
67 {
68 return 1;
69 }
70 else {
71 return 0;
72 }
73 }
74 }
75  
76 sub get_value {
77 my $self = shift;
78 return $self->{config}->{instrument}->get_power();
79 }
80  
81 sub exit {
82 my $self = shift;
83 $self->{config}->{instrument}->abort();
84 }
85  
86 1;
87  
88 __END__