| 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
| |||||||||||||
| 35 | 0 | ▶ | $len = length($str) unless $len; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 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) // ""
MC/DC0%0/1
substr($str, $start, $len) // ""
substr($str, $start, $len)
Truth table0%0/2
A
A= substr($str, $start, $len)
| |||||||||||||
| 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; | |||||||||||