File Coverage

blib/lib/Protocol/FIX/TagsAccessor.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 2 2 100.0
total 21 21 100.0


line stmt bran cond sub pod time code
1             package Protocol::FIX::TagsAccessor;
2              
3 11     11   71 use strict;
  11         22  
  11         297  
4 11     11   49 use warnings;
  11         21  
  11         1926  
5              
6             our $VERSION = '0.08'; ## VERSION
7              
8             =head1 NAME
9              
10             Protocol::FIX::TagsAccessor - access to tags of deserialized FIX messages
11              
12             =cut
13              
14             =head1 METHODS
15              
16             =head3 new
17              
18             new($class, $tag_pairs)
19              
20             Creates new TagsAccessor (performed by Parser). Not for direct usage
21             by end-users.
22              
23             =cut
24              
25             sub new {
26 54     54 1 136 my ($class, $tag_pairs) = @_;
27 54         75 my %by_name;
28 54         126 for (my $idx = 0; $idx < @$tag_pairs; $idx += 2) {
29 134         194 my $composite = $tag_pairs->[$idx];
30             # value is either value (i.e. string) or another TagAccessor
31 134         202 my $value = $tag_pairs->[$idx + 1];
32 134         411 $by_name{$composite->{name}} = $value;
33             }
34 54         202 return bless \%by_name, $class;
35             }
36              
37             =head3 value
38              
39             value($self, $name)
40              
41             Returns value. Please, refer to L
42              
43             =cut
44              
45             sub value {
46 82     82 1 6826 my ($self, $name) = @_;
47 82         374 return $self->{$name};
48             }
49              
50             1;