| 1 | package MsgPack::RPC::Message::Request; | ||
| 2 | 4 | our $AUTHORITY = 'cpan:YANICK'; | |
| 3 | # ABSTRACT: a MessagePack-RPC request | ||
| 4 | 4 | $MsgPack::RPC::Message::Request::VERSION = '2.0.3'; | |
| 5 | |||
| 6 | 4 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 4 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 4 | ▶ | use MsgPack::RPC::Message::Response; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 4 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 4 | ▶ | use MooseX::MungeHas 'is_ro'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | |||
| 14 | 4 | extends 'MsgPack::RPC::Message::Notification'; | |
| 15 | |||
| 16 | 4 | ▶ | use Promises qw/ deferred /; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | |||
| 18 | 4 | my $ID = 0; | |
| 19 | |||
| 20 | has id => ( | ||
| 21 | is => 'ro', | ||
| 22 | isa => 'Int', | ||
| 23 | lazy => 1, | ||
| 24 | 4 | ▶ | default => sub { ++$ID }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 25 | 4 | ); | |
| 26 | |||
| 27 | 0 | ▶ | sub response { |
|
Subroutine
response: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 28 | 0 | my $self = shift; | |
| 29 | |||
| 30 | 0 | MsgPack::RPC::Message::Response->new( | |
| 31 | id => $self->id, | ||
| 32 | result => shift, | ||
| 33 | ); | ||
| 34 | } | ||
| 35 | |||
| 36 | 0 | ▶ | sub response_error { |
|
Subroutine
response_error: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 37 | 0 | my $self = shift; | |
| 38 | |||
| 39 | 0 | MsgPack::RPC::Message::Response->new( | |
| 40 | id => $self->id, | ||
| 41 | error => shift, | ||
| 42 | ); | ||
| 43 | } | ||
| 44 | |||
| 45 | 2 | ▶ | sub is_request { 1} |
|
Subroutine
is_request: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 46 | 0 | ▶ | sub is_notification { 0} |
|
Subroutine
is_notification: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 47 | |||
| 48 | 3 | ▶ | sub pack { |
|
Subroutine
pack: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 49 | 3 | my $self = shift; | |
| 50 | |||
| 51 | 3 | return [ 0, $self->id, $self->method, $self->params ]; | |
| 52 | } | ||
| 53 | |||
| 54 | 4 | 1; | |
| 55 | |||
| 56 | __END__ | ||