line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Unixish::join; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $DATE = '2019-10-26'; # DATE |
4
|
|
|
|
|
|
|
our $DIST = 'Data-Unixish'; # DIST |
5
|
|
|
|
|
|
|
our $VERSION = '1.572'; # VERSION |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
433
|
use 5.010001; |
|
1
|
|
|
|
|
5
|
|
8
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
9
|
1
|
|
|
1
|
|
393
|
use syntax 'each_on_array'; # to support perl < 5.12 |
|
1
|
|
|
|
|
19324
|
|
|
1
|
|
|
|
|
3
|
|
10
|
1
|
|
|
1
|
|
2841
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
11
|
|
|
|
|
|
|
#use Log::Any '$log'; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
372
|
use Data::Unixish::Util qw(%common_args); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
239
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our %SPEC; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
$SPEC{join} = { |
18
|
|
|
|
|
|
|
v => 1.1, |
19
|
|
|
|
|
|
|
summary => 'Join elements of array into string', |
20
|
|
|
|
|
|
|
description => <<'_', |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
_ |
23
|
|
|
|
|
|
|
args => { |
24
|
|
|
|
|
|
|
%common_args, |
25
|
|
|
|
|
|
|
string => { |
26
|
|
|
|
|
|
|
summary => 'String to join elements with', |
27
|
|
|
|
|
|
|
schema => 'str*', |
28
|
|
|
|
|
|
|
default => '', |
29
|
|
|
|
|
|
|
pos => 0, |
30
|
|
|
|
|
|
|
}, |
31
|
|
|
|
|
|
|
}, |
32
|
|
|
|
|
|
|
tags => [qw/text datatype-in:array itemfunc/], |
33
|
|
|
|
|
|
|
}; |
34
|
|
|
|
|
|
|
sub join { |
35
|
2
|
|
|
2
|
1
|
7
|
my %args = @_; |
36
|
2
|
|
|
|
|
3
|
my ($in, $out) = ($args{in}, $args{out}); |
37
|
|
|
|
|
|
|
|
38
|
2
|
|
|
|
|
8
|
while (my ($index, $item) = each @$in) { |
39
|
6
|
100
|
100
|
|
|
31
|
push @$out, ref $item eq 'ARRAY' ? CORE::join($args{string}//'', @$item) : $item; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
2
|
|
|
|
|
7
|
[200, "OK"]; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub _join_item { |
46
|
6
|
|
|
6
|
|
8
|
my ($item, $args) = @_; |
47
|
|
|
|
|
|
|
|
48
|
6
|
100
|
100
|
|
|
29
|
ref $item eq 'ARRAY' ? CORE::join($args->{string}//'', @$item) : $item; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
# ABSTRACT: Join elements of array into string |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |