« blib/lib/auto/share/dist/Beekeeper/websocket/lib/MyApp/Service/Calculator/Worker.pm
↑ Summary
blib/lib/Beekeeper/Service/Supervisor.pm »
| 1 | package Beekeeper::JSONRPC::Request; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | our $VERSION = '0.09'; | ||
| 7 | |||
| 8 | |||
| 9 | sub new { | ||
| 10 | my $class = shift; | ||
| 11 | bless { | ||
| 12 | jsonrpc => '2.0', | ||
| 13 | method => undef, | ||
| 14 | params => undef, | ||
| 15 | id => undef, | ||
| 16 | @_ | ||
| 17 | }, $class; | ||
| 18 | } | ||
| 19 | |||
| 20 | sub method { $_[0]->{method} } | ||
| 21 | sub params { $_[0]->{params} } | ||
| 22 | sub id { $_[0]->{id} } | ||
| 23 | |||
| 24 | sub response { | ||
| 25 | $_[0]->{_response}; | ||
| 26 | } | ||
| 27 | |||
| 28 | sub result { | ||
| 29 | # Shortcut for $req->response->result | ||
| 30 | return ($_[0]->{_response}) ? $_[0]->{_response}->{result} : undef; | ||
| 31 | } | ||
| 32 | |||
| 33 | sub success { | ||
| 34 | # Shortcut for $req->response->success | ||
| 35 | return ($_[0]->{_response}) ? $_[0]->{_response}->success : undef; | ||
| 36 | } | ||
| 37 | |||
| 38 | sub mqtt_properties { | ||
| 39 | $_[0]->{_mqtt_properties}; | ||
| 40 | } | ||
| 41 | |||
| 42 | sub async_response { | ||
| 43 | $_[0]->{_async_response} = 1; | ||
| 44 | } | ||
| 45 | |||
| 46 | sub send_response { | ||
| 47 | $_[0]->{_worker}->__send_response(@_); | ||
| 48 | } | ||
| 49 | |||
| 50 | 1; | ||
| 51 | |||
| 52 | __END__ |