line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Unixish::rins; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
513
|
use 5.010; |
|
1
|
|
|
|
|
6
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
5
|
1
|
|
|
1
|
|
421
|
use syntax 'each_on_array'; # to support perl < 5.12 |
|
1
|
|
|
|
|
23836
|
|
|
1
|
|
|
|
|
4
|
|
6
|
1
|
|
|
1
|
|
3465
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
7
|
|
|
|
|
|
|
#use Log::Any '$log'; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
439
|
use Data::Unixish::Util qw(%common_args); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
335
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '1.571'; # VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our %SPEC; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
$SPEC{rins} = { |
16
|
|
|
|
|
|
|
v => 1.1, |
17
|
|
|
|
|
|
|
summary => 'Add some text at the end of each line of text', |
18
|
|
|
|
|
|
|
description => <<'_', |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
This is sort of a counterpart for rtrim, which removes whitespace at the end |
21
|
|
|
|
|
|
|
(right) of each line of text. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
_ |
24
|
|
|
|
|
|
|
args => { |
25
|
|
|
|
|
|
|
%common_args, |
26
|
|
|
|
|
|
|
text => { |
27
|
|
|
|
|
|
|
summary => 'The text to add', |
28
|
|
|
|
|
|
|
schema => ['str*'], |
29
|
|
|
|
|
|
|
req => 1, |
30
|
|
|
|
|
|
|
pos => 0, |
31
|
|
|
|
|
|
|
}, |
32
|
|
|
|
|
|
|
}, |
33
|
|
|
|
|
|
|
tags => [qw/text itemfunc/], |
34
|
|
|
|
|
|
|
}; |
35
|
|
|
|
|
|
|
sub rins { |
36
|
1
|
|
|
1
|
1
|
4
|
my %args = @_; |
37
|
1
|
|
|
|
|
2
|
my ($in, $out) = ($args{in}, $args{out}); |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
|
|
|
14
|
while (my ($index, $item) = each @$in) { |
40
|
4
|
|
|
|
|
10
|
push @$out, _rins_item($item, \%args); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
1
|
|
|
|
|
13
|
[200, "OK"]; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub _rins_item { |
47
|
8
|
|
|
8
|
|
16
|
my ($item, $args) = @_; |
48
|
8
|
100
|
66
|
|
|
28
|
if (defined($item) && !ref($item)) { |
49
|
6
|
|
|
|
|
33
|
$item =~ s/$/$args->{text}/mg; |
50
|
|
|
|
|
|
|
} |
51
|
8
|
|
|
|
|
30
|
return $item; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
# ABSTRACT: Add some text at the end of each line of text |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |