FIX/MessageInstance.pm

filter: Statementstmt 100% 14 / 14 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 4 / 4 totaltotal 100% 24 / 24 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
new
1.0
CRAP 1.0
« FIX/Component.pm ↑ Summary
1 package Protocol::FIX::MessageInstance;
2  
3 19 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 19 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 19 our $VERSION = '0.08'; ## VERSION
7  
8 =head1 NAME
9  
10 Protocol::FIX::MessageInstance - handy accessor for deserialized FIX message
11  
12 =cut
13  
14 =head1 METHODS
15  
16 =head3 new
17  
18 new($class, $message, $tags_accessor)
19  
20 Creates new Message Instance (performed by Parser)
21  
22 =cut
23  
24 12 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
25 12 my ($class, $message, $tags_accessor) = @_;
26 my $obj = {
27 name => $message->{name},
28 category => $message->{category},
29 12 tags_accessor => $tags_accessor,
30 };
31 12 return bless $obj, $class;
32 }
33  
34 =head3 value
35  
36 value($self, $name)
37  
38 Tiny wrapper of tag-accessors for direcly accessed message fileds.
39  
40 If C<$name> refers to field, then it returns field value.
41  
42 If C<$name> refers to component, it returns L<TagAccessor>,
43 where C<value> method can me invoked, i.e.
44  
45 $mi->value('Component')->value('Field')
46  
47 If C<$name> refers to (repetitive) group, then it returns
48 array of L<TagAccessor>s, i.e.
49  
50 $mi->value('Group')->[0]->value('Field')
51  
52 If field/component/group are not found in stream, or
53 are not direclty available in message definition, C<undef>
54 will be returned.
55  
56 =cut
57  
58 39 ▶sub value {
Subroutine value: called CC=1 SCAR=0.0
Pod documented
59 39 return shift->{tags_accessor}->value(shift);
60 }
61  
62 =head3 name
63  
64 name($self, $name)
65  
66 Returns message name, e.g. C<LogOn>
67  
68 =cut
69  
70 6 ▶sub name { return shift->{name} }
Subroutine name: called CC=1 SCAR=0.0
Pod documented
71  
72 =head3 category
73  
74 category($self, $name)
75  
76 Returns message category, e.g. C<app> or C<admin>
77  
78 =cut
79  
80 6 ▶sub category { return shift->{category} }
Subroutine category: called CC=1 SCAR=0.0
Pod documented
81  
82 19 1;
« FIX/Component.pm ↑ Summary