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.002'; |
3
|
4
|
|
|
4
|
|
2221
|
use v5.10; |
|
4
|
|
|
|
|
22
|
|
4
|
4
|
|
|
4
|
|
22
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
101
|
|
5
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
126
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
22
|
use Mooish::AttributeBuilder -standard; |
|
4
|
|
|
|
|
15
|
|
|
4
|
|
|
|
|
24
|
|
8
|
4
|
|
|
4
|
|
495
|
use Types::Standard qw(ArrayRef ConsumerOf); |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
33
|
|
9
|
4
|
|
|
4
|
|
6757
|
use List::Util qw(first); |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
390
|
|
10
|
4
|
|
|
4
|
|
29
|
use App::HL7::Compare::Exception; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
134
|
|
11
|
4
|
|
|
4
|
|
23
|
use Moo::Role; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
22
|
|
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
|
198
|
|
|
198
|
|
364
|
my ($self, $value) = @_; |
41
|
|
|
|
|
|
|
|
42
|
198
|
|
|
|
|
426
|
$value =~ s/\A\s+//; |
43
|
198
|
|
|
|
|
591
|
$value =~ s/\s+\z//; |
44
|
198
|
|
|
|
|
506
|
return $value; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub split_and_build |
48
|
|
|
|
|
|
|
{ |
49
|
98
|
|
|
98
|
0
|
221
|
my ($self, $string_to_split, $class_to_build) = @_; |
50
|
|
|
|
|
|
|
|
51
|
98
|
|
|
|
|
261
|
my @parts = map { $self->_trimmed($_) } split quotemeta($self->part_separator), $string_to_split, -1; |
|
198
|
|
|
|
|
456
|
|
52
|
|
|
|
|
|
|
|
53
|
98
|
50
|
|
|
|
288
|
App::HL7::Compare::Exception->raise("empty value for $class_to_build in: <$string_to_split>") |
54
|
|
|
|
|
|
|
if @parts == 0; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
return [ |
57
|
|
|
|
|
|
|
map { |
58
|
164
|
|
|
|
|
10707
|
$class_to_build->new( |
59
|
|
|
|
|
|
|
msg_config => $self->msg_config, |
60
|
|
|
|
|
|
|
number => $_ + 1, |
61
|
|
|
|
|
|
|
input => $parts[$_], |
62
|
|
|
|
|
|
|
) |
63
|
|
|
|
|
|
|
} grep { |
64
|
98
|
|
|
|
|
233
|
length $parts[$_] > 0 |
|
198
|
|
|
|
|
502
|
|
65
|
|
|
|
|
|
|
} 0 .. $#parts |
66
|
|
|
|
|
|
|
]; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
|