| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package MsgPack::RPC::Message::Notification; |
|
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:YANICK'; |
|
3
|
|
|
|
|
|
|
# ABSTRACT: a MessagePack-RPC request |
|
4
|
|
|
|
|
|
|
$MsgPack::RPC::Message::Notification::VERSION = '2.0.2'; |
|
5
|
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
1237
|
use strict; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
66
|
|
|
7
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
|
2
|
|
|
|
|
7
|
|
|
|
2
|
|
|
|
|
49
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
10
|
use Moose; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
12
|
|
|
10
|
2
|
|
|
2
|
|
13346
|
use MooseX::MungeHas 'is_ro'; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
15
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
extends 'MsgPack::RPC::Message'; |
|
13
|
|
|
|
|
|
|
|
|
14
|
2
|
|
|
2
|
|
2081
|
use Promises qw/ deferred /; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
12
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has method => ( |
|
17
|
|
|
|
|
|
|
required => 1, |
|
18
|
|
|
|
|
|
|
); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has params => ( |
|
21
|
|
|
|
|
|
|
lazy => 1, |
|
22
|
|
|
|
|
|
|
default => sub { [] }, |
|
23
|
|
|
|
|
|
|
traits => [ 'Array' ], |
|
24
|
|
|
|
|
|
|
handles => { all_params => 'elements' }, |
|
25
|
|
|
|
|
|
|
); |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub pack { |
|
28
|
2
|
|
|
2
|
0
|
7
|
my $self = shift; |
|
29
|
|
|
|
|
|
|
|
|
30
|
2
|
|
|
|
|
53
|
return [ 2, $self->method, $self->params ]; |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
0
|
|
|
0
|
0
|
|
sub is_notification { 1} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__END__ |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=pod |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=encoding UTF-8 |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 NAME |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
MsgPack::RPC::Message::Notification - a MessagePack-RPC request |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 VERSION |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
version 2.0.2 |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
use MsgPack::RPC; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
my $rpc = MsgPack::RPC->new( io => '127.0.0.1:6543' ); |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
$rpc->emit( some_request => 'MsgPack::RPC::Message::Request', args => [ 1..5 ] ); |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Sub-class of L<MsgPack::RPC::Message> representing an incoming request. |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 METHODS |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 new( args => $args, message_id => $id ) |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Accepts the same argument as L<MsgPack::RPC::Message>, plus C<message_id>, |
|
68
|
|
|
|
|
|
|
the id of the request. |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 response |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Returns a L<Promises::Deferred> that, once fulfilled, sends the response back with the provided arguments. |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
$rpc->subscribe( something => sub { |
|
75
|
|
|
|
|
|
|
my $request = shift; |
|
76
|
|
|
|
|
|
|
$request->response->resolve('a-okay'); |
|
77
|
|
|
|
|
|
|
}); |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 resp($args) |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Shortcut for |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
$request->response->resolve($args) |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 error($args) |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Shortcut for |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
$request->response->reject($args) |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 AUTHOR |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Yanick Champoux <yanick@cpan.org> |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
This software is copyright (c) 2019, 2017, 2016, 2015 by Yanick Champoux. |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
100
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |