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.001';
3 3     3   49 use v5.10;
  3         12  
4 3     3   18 use strict;
  3         7  
  3         112  
5 3     3   18 use warnings;
  3         11  
  3         90  
6              
7 3     3   17 use Moo;
  3         6  
  3         29  
8 3     3   1210 use Mooish::AttributeBuilder -standard;
  3         24  
  3         41  
9 3     3   416 use Types::Standard qw(Str);
  3         7  
  3         21  
10              
11 3     3   5731 use App::HL7::Compare::Parser::Field;
  3         15  
  3         808  
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 64     64 0 117 my ($self) = @_;
27              
28 64         868 return $self->msg_config->field_separator;
29             }
30              
31             sub _build_parts
32             {
33 14     14   126 my ($self) = @_;
34              
35 14         38 return $self->split_and_build($self->consume_input, 'App::HL7::Compare::Parser::Field');
36             }
37              
38             sub BUILD
39             {
40 50     50 0 11091 my ($self, $args) = @_;
41              
42 50         131 my $input = $self->consume_input;
43 50         127 my ($name, $rest) = split quotemeta($self->part_separator), $input, 2;
44 50         998 $self->_set_name($name);
45 50         2008 $self->_set_input($rest);
46             }
47              
48             1;
49