| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Clean::Backspace; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
30249
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
48
|
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
272
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.03'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# create new object |
|
9
|
|
|
|
|
|
|
sub new { |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# class name |
|
12
|
1
|
|
|
1
|
0
|
11
|
my $class = shift; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# allocate memory |
|
15
|
1
|
|
|
|
|
2
|
my $self = {}; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# assign object to class |
|
18
|
1
|
|
|
|
|
3
|
bless($self, $class); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# return object reference |
|
21
|
1
|
|
|
|
|
3
|
return $self; |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# backspace method |
|
25
|
|
|
|
|
|
|
sub backspace { |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# object reference |
|
28
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# loop through list of array references |
|
31
|
0
|
|
|
|
|
|
for (@_){ |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# loop through string references |
|
34
|
0
|
|
|
|
|
|
for (@$_){ |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# convert string to ascii decimal values and reverse order |
|
37
|
0
|
|
|
|
|
|
my @tmp = unpack("C*", reverse($$_)); |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# delete character count |
|
40
|
0
|
|
|
|
|
|
my $del = 0; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# new string |
|
43
|
0
|
|
|
|
|
|
my @new; |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# loop through character ascii values |
|
46
|
0
|
|
|
|
|
|
for (@tmp){ |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# look for ascii 8 backspace |
|
49
|
0
|
0
|
|
|
|
|
if ($_ == 8){ |
|
|
|
0
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# increment number of characters to delete |
|
52
|
0
|
|
|
|
|
|
$del++; |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# skip over this character |
|
55
|
0
|
|
|
|
|
|
next; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# check if any characters to delete |
|
59
|
|
|
|
|
|
|
elsif ($del != 0){ |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# decrement number of characters to delete |
|
62
|
0
|
|
|
|
|
|
$del--; |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# skip over this character |
|
65
|
0
|
|
|
|
|
|
next; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# if ascii not equal to 8 or delete condition equals 0 |
|
69
|
|
|
|
|
|
|
else{ |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# store ascii value |
|
72
|
0
|
|
|
|
|
|
push (@new, $_); |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# convert ascii back to characters and reverse back to original order |
|
77
|
0
|
|
|
|
|
|
$$_ = pack("C*", reverse(@new)); |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
__END__ |