line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# This file is part of App-PythonToPerl |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# This software is Copyright (c) 2023 by Auto-Parallel Technologies, Inc. |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# This is free software, licensed under: |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# The GNU General Public License, Version 3, June 2007 |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
# [[[ HEADER ]]] |
11
|
|
|
|
|
|
|
# ABSTRACT: champ is like chomp, but better? |
12
|
|
|
|
|
|
|
#use RPerl; |
13
|
|
|
|
|
|
|
package Champ; |
14
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
30
|
|
15
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
55
|
|
16
|
|
|
|
|
|
|
our $VERSION = 0.001_000; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# [[[ CRITICS ]]] |
19
|
|
|
|
|
|
|
## no critic qw(ProhibitUselessNoCritic ProhibitMagicNumbers RequireCheckedSyscalls) # USER DEFAULT 1: allow numeric values & print op |
20
|
|
|
|
|
|
|
## no critic qw(RequireInterpolationOfMetachars) # USER DEFAULT 2: allow single-quoted control characters & sigils |
21
|
|
|
|
|
|
|
## no critic qw(ProhibitConstantPragma ProhibitMagicNumbers) # USER DEFAULT 3: allow constants |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# [[[ EXPORTS ]]] |
24
|
|
|
|
|
|
|
#use RPerl::Exporter qw(import); |
25
|
1
|
|
|
1
|
|
9
|
use Exporter qw(import); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
60
|
|
26
|
|
|
|
|
|
|
our @EXPORT = qw(champ); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# [[[ INCLUDES ]]] |
29
|
1
|
|
|
1
|
|
9
|
use Perl::Types; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
452
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# [[[ SUBROUTINES ]]] |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# NEED UPGRADE: move helper subroutine(s) into their own distribution |
34
|
|
|
|
|
|
|
# NEED UPGRADE: move helper subroutine(s) into their own distribution |
35
|
|
|
|
|
|
|
# NEED UPGRADE: move helper subroutine(s) into their own distribution |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub champ { |
38
|
|
|
|
|
|
|
# champ is like chomp, except it returns the chomped string instead of the number of characters removed, and does not alter the original |
39
|
120
|
|
|
120
|
0
|
152
|
{ my string $RETURN_TYPE }; |
|
120
|
|
|
|
|
161
|
|
40
|
120
|
|
|
|
|
216
|
( my string $input_string ) = @ARG; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# NEED UPGRADE: need add error checking & graceful failure via croak() |
43
|
|
|
|
|
|
|
# NEED UPGRADE: need add error checking & graceful failure via croak() |
44
|
|
|
|
|
|
|
# NEED UPGRADE: need add error checking & graceful failure via croak() |
45
|
|
|
|
|
|
|
|
46
|
120
|
|
|
|
|
170
|
my string $output_string = $input_string; |
47
|
120
|
|
|
|
|
183
|
chomp $output_string; |
48
|
120
|
|
|
|
|
1201
|
return $output_string; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |