XPRESS/Sweep/Repeater.pm untested

filter: Statementstmt 0.0% 0 / 39 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 56 CC 3 SCAR 13.9
CC
3
Cov
0%
new
6.0
get_value
6.0
BEGIN
2.0
CRAP 4.0
1 package Lab::XPRESS::Sweep::Repeater;
2 #ABSTRACT: Simple repeater
3 $Lab::XPRESS::Sweep::Repeater::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 => 'Repeater',
18 filename_extension => '#',
19 repetitions => 1,
20 stepwidth => 1,
21 points => [1],
22 rate => [1],
23 mode => 'list',
24 allowed_sweep_modes => ['list'],
25 backsweep => 0,
26 values => undef,
27 };
28  
29 $self = $class->SUPER::new( $self->{default_config}, @args );
30 bless( $self, $class );
31 $self->{config}->{points} = [1];
32 $self->{config}->{duration} = [1];
33  
34 if ( ref( $self->{config}->{repetitions} ) eq 'ARRAY' ) {
35 $self->{config}->{values} = $self->{config}->{repetitions};
36 $self->{config}->{repetitions}
37 = scalar @{ $self->{config}->{repetitions} };
38 }
39  
40 $self->{config}->{mode} = 'list';
41 $self->{loop}->{interval} = $self->{config}->{interval};
42  
43 $self->{DataFile_counter} = 0;
44  
45 $self->{DataFiles} = ();
46  
47 return $self;
48 }
49  
50 sub get_value {
51 my $self = shift;
52  
53 if ( defined $self->{config}->{values} ) {
54 return @{ $self->{config}->{values} }[ $self->{repetition} - 1 ];
55 }
56 else {
57 return $self->{repetition};
58 }
59 }
60  
61 1;
62  
63 __END__