File Coverage

blib/lib/App/HL7/Compare/Parser/Segment.pm
Criterion Covered Total %
statement 29 29 100.0
branch n/a
condition n/a
subroutine 10 10 100.0
pod 0 2 0.0
total 39 41 95.1


line stmt bran cond sub pod time code
1             package App::HL7::Compare::Parser::Segment;
2             $App::HL7::Compare::Parser::Segment::VERSION = '0.004';
3 4     4   58 use v5.10;
  4         16  
4 4     4   27 use strict;
  4         8  
  4         108  
5 4     4   19 use warnings;
  4         7  
  4         235  
6              
7 4     4   20 use Moo;
  4         9  
  4         30  
8 4     4   1856 use Mooish::AttributeBuilder -standard;
  4         10  
  4         52  
9 4     4   557 use Types::Standard qw(Str);
  4         8  
  4         26  
10              
11 4     4   8834 use App::HL7::Compare::Parser::Field;
  4         15  
  4         984  
12              
13             has field 'name' => (
14             isa => Str,
15             writer => -hidden,
16             );
17              
18             with qw(
19             App::HL7::Compare::Parser::Role::Partible
20             App::HL7::Compare::Parser::Role::RequiresInput
21             App::HL7::Compare::Parser::Role::Part
22             );
23              
24             sub part_separator
25             {
26 88     88 0 176 my ($self) = @_;
27              
28 88         2137 return $self->msg_config->field_separator;
29             }
30              
31             sub _build_parts
32             {
33 24     24   197 my ($self) = @_;
34              
35 24         65 return $self->split_and_build($self->consume_input, 'App::HL7::Compare::Parser::Field');
36             }
37              
38             sub BUILD
39             {
40 64     64 0 19117 my ($self, $args) = @_;
41              
42 64         200 my $input = $self->consume_input;
43 64         187 my ($name, $rest) = split quotemeta($self->part_separator), $input, 2;
44 64         1529 $self->_set_name($name);
45 64         3009 $self->_set_input($rest);
46             }
47              
48             1;
49