| line | stmt | bran | cond | sub | pod | time | code | 
| 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 | 19 |  |  | 19 |  | 118 | use strict; | 
|  | 19 |  |  | 17 |  | 37 |  | 
|  | 19 |  |  |  |  | 522 |  | 
|  | 17 |  |  |  |  | 18440 |  | 
|  | 1 |  |  |  |  | 365 |  | 
|  | 1 |  |  |  |  | 4 |  | 
| 8 | 19 |  |  | 19 |  | 85 | use warnings; | 
|  | 19 |  |  | 1 |  | 30 |  | 
|  | 19 |  |  |  |  | 694 |  | 
|  | 1 |  |  |  |  | 2886 |  | 
|  | 1 |  |  |  |  | 169 |  | 
|  | 1 |  |  |  |  | 5 |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 | 19 |  |  | 19 |  | 88 | use Exporter 'import'; | 
|  | 19 |  |  | 1 |  | 34 |  | 
|  | 19 |  |  |  |  | 5472 |  | 
|  | 1 |  |  |  |  | 988 |  | 
|  | 1 |  |  |  |  | 50 |  | 
|  | 1 |  |  |  |  | 4 |  | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | my @all_symbols = qw($f $F $n $N $m $. @m $I ss pf spf $PerlEnv_LOADED); | 
| 13 |  |  |  |  |  |  | our @EXPORT = (); | 
| 14 |  |  |  |  |  |  | # This array is read directly to share all these symbols with the Safe. | 
| 15 |  |  |  |  |  |  | our @EXPORT_OK = @all_symbols; | 
| 16 |  |  |  |  |  |  | our %EXPORT_TAGS = (all => \@all_symbols); | 
| 17 |  |  |  |  |  |  | # Marker that can be checked to know if the module is loaded. | 
| 18 |  |  |  |  |  |  | our $PerlEnv_LOADED = 1; | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | our $f;  # This will be the name of the processed file, shared with the safe. | 
| 21 |  |  |  |  |  |  | our $F;  # The absolute path to the input file. | 
| 22 |  |  |  |  |  |  | our $n;  # This will be the current line number, shared with the safe. | 
| 23 |  |  |  |  |  |  | our $N;  # This will be the total number of lines of the input. | 
| 24 |  |  |  |  |  |  | our $m;  # The marker of the current line. | 
| 25 |  |  |  |  |  |  | our $.;  # The standard name for the $n variable. | 
| 26 |  |  |  |  |  |  | our @m;  # The read-only version of @markers (with read relative). | 
| 27 |  |  |  |  |  |  | our $I;  # The index of the file being processed. | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | sub ss ($;$$) { | 
| 30 | 0 |  |  | 0 | 0 | 0 | my ($start, $len, $str) = @_; | 
|  | 0 |  |  | 0 | 0 | 0 |  | 
| 31 | 0 | 0 |  |  |  | 0 | $str = $_ unless defined $str; | 
|  | 0 | 0 |  |  |  | 0 |  | 
| 32 | 0 | 0 |  |  |  | 0 | $len = length($str) unless $len; | 
|  | 0 | 0 |  |  |  | 0 |  | 
| 33 |  |  |  |  |  |  | # print "start=${start}; len=${len}; str=${str}\n"; | 
| 34 |  |  |  |  |  |  | # substr returns undef for sub-strings outside the original string. This would | 
| 35 |  |  |  |  |  |  | # remove the input line, so instead we're keeping an empty string. | 
| 36 | 0 |  | 0 |  |  | 0 | substr($str, $start, $len) // ''; | 
|  | 0 |  | 0 |  |  | 0 |  | 
| 37 |  |  |  |  |  |  | } | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | sub pf($@) { | 
| 40 | 3 |  |  | 3 | 0 | 8 | my ($format, @args) = @_; | 
|  | 0 |  |  | 0 | 0 | 0 |  | 
| 41 |  |  |  |  |  |  | # print "format=${format} args=(".join(', ', @args).")\n"; | 
| 42 | 3 |  |  |  |  | 21 | $_ = sprintf $format, @args; | 
|  | 0 |  |  |  |  | 0 |  | 
| 43 |  |  |  |  |  |  | } | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | sub spf($@) { | 
| 46 | 2 |  |  | 2 | 0 | 10 | my ($format, @args) = @_; | 
|  | 0 |  |  | 0 | 0 |  |  | 
| 47 |  |  |  |  |  |  | # print "format=${format} args=(".join(', ', @args).")\n"; | 
| 48 | 2 |  |  |  |  | 18 | sprintf $format, @args; | 
|  | 0 |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | } | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | 1; |