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