| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package App::HL7::Compare::Parser::Role::Partible; |
|
2
|
|
|
|
|
|
|
$App::HL7::Compare::Parser::Role::Partible::VERSION = '0.001'; |
|
3
|
3
|
|
|
3
|
|
1690
|
use v5.10; |
|
|
3
|
|
|
|
|
12
|
|
|
4
|
3
|
|
|
3
|
|
18
|
use strict; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
74
|
|
|
5
|
3
|
|
|
3
|
|
18
|
use warnings; |
|
|
3
|
|
|
|
|
11
|
|
|
|
3
|
|
|
|
|
95
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
18
|
use Mooish::AttributeBuilder -standard; |
|
|
3
|
|
|
|
|
14
|
|
|
|
3
|
|
|
|
|
25
|
|
|
8
|
3
|
|
|
3
|
|
358
|
use Types::Standard qw(ArrayRef ConsumerOf); |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
21
|
|
|
9
|
3
|
|
|
3
|
|
5113
|
use List::Util qw(first); |
|
|
3
|
|
|
|
|
9
|
|
|
|
3
|
|
|
|
|
322
|
|
|
10
|
3
|
|
|
3
|
|
357
|
use App::HL7::Compare::Exception; |
|
|
3
|
|
|
|
|
9
|
|
|
|
3
|
|
|
|
|
116
|
|
|
11
|
3
|
|
|
3
|
|
19
|
use Moo::Role; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
19
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has field 'parts' => ( |
|
14
|
|
|
|
|
|
|
isa => ArrayRef [ConsumerOf ['App::HL7::Compare::Parser::Role::Part']], |
|
15
|
|
|
|
|
|
|
lazy => 1, |
|
16
|
|
|
|
|
|
|
); |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
with qw( |
|
19
|
|
|
|
|
|
|
App::HL7::Compare::Parser::Role::Stringifies |
|
20
|
|
|
|
|
|
|
App::HL7::Compare::Parser::Role::PartOfMessage |
|
21
|
|
|
|
|
|
|
); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
requires qw( |
|
24
|
|
|
|
|
|
|
part_separator |
|
25
|
|
|
|
|
|
|
_build_parts |
|
26
|
|
|
|
|
|
|
); |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub to_string |
|
29
|
|
|
|
|
|
|
{ |
|
30
|
0
|
|
|
0
|
0
|
0
|
my ($self) = @_; |
|
31
|
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
0
|
my $parts = $self->parts; |
|
33
|
0
|
0
|
|
|
|
0
|
return '' unless @{$parts} > 0; |
|
|
0
|
|
|
|
|
0
|
|
|
34
|
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
0
|
return join $self->part_separator, map { $_->to_string } @{$parts}; |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub _trimmed |
|
39
|
|
|
|
|
|
|
{ |
|
40
|
153
|
|
|
153
|
|
272
|
my ($self, $value) = @_; |
|
41
|
|
|
|
|
|
|
|
|
42
|
153
|
|
|
|
|
312
|
$value =~ s/\A\s+//; |
|
43
|
153
|
|
|
|
|
532
|
$value =~ s/\s+\z//; |
|
44
|
153
|
|
|
|
|
413
|
return $value; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub split_and_build |
|
48
|
|
|
|
|
|
|
{ |
|
49
|
84
|
|
|
84
|
0
|
181
|
my ($self, $string_to_split, $class_to_build) = @_; |
|
50
|
|
|
|
|
|
|
|
|
51
|
84
|
|
|
|
|
214
|
my @parts = map { $self->_trimmed($_) } split quotemeta($self->part_separator), $string_to_split; |
|
|
153
|
|
|
|
|
346
|
|
|
52
|
|
|
|
|
|
|
|
|
53
|
84
|
50
|
|
|
|
235
|
App::HL7::Compare::Exception->raise("empty value for $class_to_build") |
|
54
|
|
|
|
|
|
|
if @parts == 0; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
return [ |
|
57
|
|
|
|
|
|
|
map { |
|
58
|
146
|
|
|
|
|
7612
|
$class_to_build->new( |
|
59
|
|
|
|
|
|
|
msg_config => $self->msg_config, |
|
60
|
|
|
|
|
|
|
number => $_ + 1, |
|
61
|
|
|
|
|
|
|
input => $parts[$_], |
|
62
|
|
|
|
|
|
|
) |
|
63
|
|
|
|
|
|
|
} grep { |
|
64
|
84
|
|
|
|
|
189
|
length $parts[$_] > 0 |
|
|
153
|
|
|
|
|
349
|
|
|
65
|
|
|
|
|
|
|
} 0 .. $#parts |
|
66
|
|
|
|
|
|
|
]; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
|
70
|
|
|
|
|
|
|
|