line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MR::IProto::Response; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
MR::IProto::Response - response message |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Base class for all response messages. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
511
|
use Mouse; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
14
|
|
|
|
|
|
|
extends 'MR::IProto::Message'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 PUBLIC ATTRIBUTES |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=over |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=item request |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Instance of L. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has request => ( |
27
|
|
|
|
|
|
|
is => 'ro', |
28
|
|
|
|
|
|
|
isa => 'MR::IProto::Request', |
29
|
|
|
|
|
|
|
required => 1, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=back |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 PUBLIC METHODS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=over |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=item retry |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Is request retry must be done. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub retry { |
45
|
0
|
|
|
0
|
1
|
|
return 0; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=back |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 PROTECTED METHODS |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=over |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item BUILDARGS( %args | \%args | $data ) |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
If C<$data> is passed as argument then it unpacked and object is |
57
|
|
|
|
|
|
|
created based on information contained in it. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
See L for more information. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
around BUILDARGS => sub { |
64
|
|
|
|
|
|
|
my ($orig, $class, %args) = @_; |
65
|
|
|
|
|
|
|
if( exists $args{data} ) { |
66
|
|
|
|
|
|
|
my $parsed_args = $class->_parse_data($args{data}); |
67
|
|
|
|
|
|
|
my $tail = delete $parsed_args->{data}; |
68
|
|
|
|
|
|
|
warn "Not all data was parsed" if defined $tail && length $tail; |
69
|
|
|
|
|
|
|
return $class->$orig(%$parsed_args, %args); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
else { |
72
|
|
|
|
|
|
|
return $class->$orig(%args); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
}; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item _parse_data( $data ) |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
You B implement this method in you subclass to unpack your object. |
79
|
|
|
|
|
|
|
Returns hashref of attributes which will be passed to constructor. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub _parse_data { |
84
|
0
|
|
|
0
|
|
|
return { data => $_[1] }; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=back |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
90
|
|
|
|
|
|
|
|
91
|
1
|
|
|
1
|
|
471
|
no Mouse; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
92
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable(); |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1; |