lib/MLPerl/PythonShims.pm untested

filter: Statementstmt 0.0% 0 / 39 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 49 CC 1 SCAR 6.9
CC
1
Cov
0%
concatenate
2.0
range
2.0
for_range
2.0
CRAP 2.0
1 # [[[ HEADER ]]]
2 use RPerl;
3 package MLPerl::PythonShims;
4 use strict;
5 use warnings;
6 our $VERSION = 0.001_000;
7  
8 # [[[ CRITICS ]]]
9 ## no critic qw(ProhibitUselessNoCritic ProhibitMagicNumbers RequireCheckedSyscalls) # USER DEFAULT 1: allow numeric values & print operator
10 ## no critic qw(RequireInterpolationOfMetachars) # USER DEFAULT 2: allow single-quoted control characters & sigils
11  
12 # [[[ EXPORTS ]]]
13 use RPerl::Exporter qw(import);
14 our @EXPORT_OK = qw(concatenate range for_range);
15  
16 # [[[ SUBROUTINES ]]]
17  
18 # NEED FIX: move all subroutines to some appropriate library file
19 sub concatenate {
20 { my number_arrayref $RETURN_TYPE };
21 ( my number_arrayref $input_0, my number_arrayref $input_1 ) = @ARG;
22 return [@{$input_0}, @{$input_1}];
23 }
24  
25  
26 # range(start, stop, step) # PYTHON
27 # NEED UPGRADE: enable all 3 input parameters
28 sub range {
29 { my integer_arrayref $RETURN_TYPE };
30 # ( my integer $start, my integer $stop, my integer $step ) = @ARG;
31 ( my integer $stop ) = @ARG;
32 return [0 .. ($stop - 1)];
33 }
34  
35  
36 # NEED FIX: creates strings instead of integers, which do we want???
37 # create arrayref of integer repeated a certain number of times
38 sub for_range {
39 { my string_arrayref $RETURN_TYPE };
40 ( my string $input, my integer $repetitions ) = @ARG;
41 # print 'in for_range(), received $input = ', $input, "\n";
42 # print 'in for_range(), received $repetitions = ', $repetitions, "\n";
43  
44 my string_arrayref $input_repeated = [];
45  
46 for (my integer $i = 0; $i < $repetitions; $i++) {
47 $input_repeated->[$i] = $input;
48 }
49 return $input_repeated;
50 }
51  
52 1; # end of package