PTP/PerlEnv.pm

filter: Statementstmt 76.4% 26 / 34 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 57.1% 4 / 7 Podpod 0.0% 0 / 3 totaltotal 58.8% 30 / 51 CC 4 SCAR 21.7
CC
4
Cov
65%
ss
20.0
pf
2.0
spf
2.0
CRAP 8.8
« PTP/Args.pm ↑ Summary PTP/Util.pm »
1 # This package is the one that provides the symbol accessible to the user
2 # supplied Perl code. The global variables are manipulated and set by the
3 # App::PTP::Commands package.
4  
5 package App::PTP::PerlEnv;
6  
7 2 ▶use 5.022;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 2 our $VERSION = '0.01';
14  
15 2 my @all_symbols = qw($f $F $n $N $m $. @m $I ss pf spf $PerlEnv_LOADED);
16 2 our @EXPORT = ();
17 # This array is read directly to share all these symbols with the Safe.
18 2 our @EXPORT_OK = @all_symbols;
19 2 our %EXPORT_TAGS = (all => \@all_symbols);
20 # Marker that can be checked to know if the module is loaded.
21 2 our $PerlEnv_LOADED = 1;
22  
23 2 our $f; # This will be the name of the processed file, shared with the safe.
24 2 our $F; # The absolute path to the input file.
25 2 our $n; # This will be the current line number, shared with the safe.
26 2 our $N; # This will be the total number of lines of the input.
27 2 our $m; # The marker of the current line.
28 2 our $.; # The standard name for the $n variable.
29 2 our @m; # The read-only version of @markers (with read relative).
30 2 our $I; # The index of the file being processed.
31  
32 0 ▶sub ss ($;$$) {
Subroutine ss: not called CC=4 SCAR=30.0
Pod undocumented
33 0 my ($start, $len, $str) = @_;
34 0 ▶ $str = $_ unless defined $str;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $str 0 0 0
35 0 ▶ $len = length($str) unless $len;
Branch: 1 branch
BranchTrueFalseTotal
unless $len 0 0 0
36 # print "start=${start}; len=${len}; str=${str}\n";
37 # substr returns undef for sub-strings outside the original string. This would
38 # remove the input line, so instead we're keeping an empty string.
39 0 ▶ substr($str, $start, $len) // '';
Condition0%0/2
substr($str, $start, $len) // ""
l!l
00
MC/DC0%0/1
substr($str, $start, $len) // ""
substr($str, $start, $len)
Truth table0%0/2
A
A= substr($str, $start, $len)
Aresult
11
00
40 }
41  
42 0 ▶sub pf ($@) {
Subroutine pf: not called CC=1 SCAR=6.9
Pod undocumented
43 0 my ($format, @args) = @_;
44 # print "format=${format} args=(".join(', ', @args).")\n";
45 0 $_ = sprintf $format, @args;
46 }
47  
48 0 ▶sub spf ($@) {
Subroutine spf: not called CC=1 SCAR=6.9
Pod undocumented
49 0 my ($format, @args) = @_;
50 # print "format=${format} args=(".join(', ', @args).")\n";
51 0 sprintf $format, @args;
52 }
53  
54 2 1;
« PTP/Args.pm ↑ Summary PTP/Util.pm »