Slack/RTM.pm

filter: Statementstmt 86.1% 342 / 397 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 10 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 88.9% 113 / 127 Podpod 33.3% 4 / 12 totaltotal 80.5% 459 / 570 CC 15 SCAR 12.6
CC
15
Cov
80%
on_frame
42.0
configure
12.0
events
6.0
CRAP 3.5
« Slack/Event/Channel.pm ↑ Summary Slack/Event/Message.pm »
1 package Net::Async::Slack::RTM;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 our $VERSION = '0.015'; # VERSION
7  
8 2 ▶use parent qw(IO::Async::Notifier);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 =head1 NAME
11  
12 Net::Async::Slack::RTM - realtime messaging support for L<https://slack.com>
13  
14 =head1 DESCRIPTION
15  
16 This is a basic wrapper for Slack's RTM features.
17  
18 The realtime messaging API is mostly useful as an event stream. Although it is
19 possible to send messages through this API as well - see L</send_message> - the
20 main HTTP API offers more features.
21  
22 For a full list of events, see L<https://api.slack.com/events>.
23  
24 =cut
25  
26 2 ▶no indirect;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 2 ▶use mro;
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 2 ▶use Future;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 2 ▶use Dir::Self;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 2 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
32 2 ▶use URI::QueryParam;
Subroutine BEGIN: called CC=1 SCAR=0.0
33 2 ▶use URI::Template;
Subroutine BEGIN: called CC=1 SCAR=0.0
34 2 ▶use JSON::MaybeXS;
Subroutine BEGIN: called CC=1 SCAR=0.0
35 2 ▶use Time::Moment;
Subroutine BEGIN: called CC=1 SCAR=0.0
36 2 ▶use Syntax::Keyword::Try;
Subroutine BEGIN: called CC=1 SCAR=0.0
37  
38 2 ▶use IO::Async::Timer::Countdown;
Subroutine BEGIN: called CC=1 SCAR=0.0
39 2 ▶use Net::Async::WebSocket::Client;
Subroutine BEGIN: called CC=1 SCAR=0.0
40  
41 2 ▶use Net::Async::Slack::Event::AccountsChanged;
Subroutine BEGIN: called CC=1 SCAR=0.0
42 2 ▶use Net::Async::Slack::Event::AppHomeOpened;
Subroutine BEGIN: called CC=1 SCAR=0.0
43 2 ▶use Net::Async::Slack::Event::AppMention;
Subroutine BEGIN: called CC=1 SCAR=0.0
44 2 ▶use Net::Async::Slack::Event::AppRateLimited;
Subroutine BEGIN: called CC=1 SCAR=0.0
45 2 ▶use Net::Async::Slack::Event::AppUninstalled;
Subroutine BEGIN: called CC=1 SCAR=0.0
46 2 ▶use Net::Async::Slack::Event::BotAdded;
Subroutine BEGIN: called CC=1 SCAR=0.0
47 2 ▶use Net::Async::Slack::Event::BotChanged;
Subroutine BEGIN: called CC=1 SCAR=0.0
48 2 ▶use Net::Async::Slack::Event::Bot;
Subroutine BEGIN: called CC=1 SCAR=0.0
49 2 ▶use Net::Async::Slack::Event::ChannelArchive;
Subroutine BEGIN: called CC=1 SCAR=0.0
50 2 ▶use Net::Async::Slack::Event::ChannelCreated;
Subroutine BEGIN: called CC=1 SCAR=0.0
51 2 ▶use Net::Async::Slack::Event::ChannelDeleted;
Subroutine BEGIN: called CC=1 SCAR=0.0
52 2 ▶use Net::Async::Slack::Event::ChannelHistoryChanged;
Subroutine BEGIN: called CC=1 SCAR=0.0
53 2 ▶use Net::Async::Slack::Event::ChannelJoined;
Subroutine BEGIN: called CC=1 SCAR=0.0
54 2 ▶use Net::Async::Slack::Event::ChannelLeft;
Subroutine BEGIN: called CC=1 SCAR=0.0
55 2 ▶use Net::Async::Slack::Event::ChannelMarked;
Subroutine BEGIN: called CC=1 SCAR=0.0
56 2 ▶use Net::Async::Slack::Event::Channel;
Subroutine BEGIN: called CC=1 SCAR=0.0
57 2 ▶use Net::Async::Slack::Event::ChannelRename;
Subroutine BEGIN: called CC=1 SCAR=0.0
58 2 ▶use Net::Async::Slack::Event::ChannelUnarchive;
Subroutine BEGIN: called CC=1 SCAR=0.0
59 2 ▶use Net::Async::Slack::Event::CommandsChanged;
Subroutine BEGIN: called CC=1 SCAR=0.0
60 2 ▶use Net::Async::Slack::Event::DndUpdated;
Subroutine BEGIN: called CC=1 SCAR=0.0
61 2 ▶use Net::Async::Slack::Event::DndUpdatedUser;
Subroutine BEGIN: called CC=1 SCAR=0.0
62 2 ▶use Net::Async::Slack::Event::EmailDomainChanged;
Subroutine BEGIN: called CC=1 SCAR=0.0
63 2 ▶use Net::Async::Slack::Event::EmojiChanged;
Subroutine BEGIN: called CC=1 SCAR=0.0
64 2 ▶use Net::Async::Slack::Event::FileChange;
Subroutine BEGIN: called CC=1 SCAR=0.0
65 2 ▶use Net::Async::Slack::Event::FileCommentAdded;
Subroutine BEGIN: called CC=1 SCAR=0.0
66 2 ▶use Net::Async::Slack::Event::FileCommentDeleted;
Subroutine BEGIN: called CC=1 SCAR=0.0
67 2 ▶use Net::Async::Slack::Event::FileCommentEdited;
Subroutine BEGIN: called CC=1 SCAR=0.0
68 2 ▶use Net::Async::Slack::Event::FileCreated;
Subroutine BEGIN: called CC=1 SCAR=0.0
69 2 ▶use Net::Async::Slack::Event::FileDeleted;
Subroutine BEGIN: called CC=1 SCAR=0.0
70 2 ▶use Net::Async::Slack::Event::FilePublic;
Subroutine BEGIN: called CC=1 SCAR=0.0
71 2 ▶use Net::Async::Slack::Event::FileShared;
Subroutine BEGIN: called CC=1 SCAR=0.0
72 2 ▶use Net::Async::Slack::Event::FileUnshared;
Subroutine BEGIN: called CC=1 SCAR=0.0
73 2 ▶use Net::Async::Slack::Event::Goodbye;
Subroutine BEGIN: called CC=1 SCAR=0.0
74 2 ▶use Net::Async::Slack::Event::GridMigrationFinished;
Subroutine BEGIN: called CC=1 SCAR=0.0
75 2 ▶use Net::Async::Slack::Event::GridMigrationStarted;
Subroutine BEGIN: called CC=1 SCAR=0.0
76 2 ▶use Net::Async::Slack::Event::GroupArchive;
Subroutine BEGIN: called CC=1 SCAR=0.0
77 2 ▶use Net::Async::Slack::Event::GroupClose;
Subroutine BEGIN: called CC=1 SCAR=0.0
78 2 ▶use Net::Async::Slack::Event::GroupDeleted;
Subroutine BEGIN: called CC=1 SCAR=0.0
79 2 ▶use Net::Async::Slack::Event::GroupHistoryChanged;
Subroutine BEGIN: called CC=1 SCAR=0.0
80 2 ▶use Net::Async::Slack::Event::GroupJoined;
Subroutine BEGIN: called CC=1 SCAR=0.0
81 2 ▶use Net::Async::Slack::Event::GroupLeft;
Subroutine BEGIN: called CC=1 SCAR=0.0
82 2 ▶use Net::Async::Slack::Event::GroupMarked;
Subroutine BEGIN: called CC=1 SCAR=0.0
83 2 ▶use Net::Async::Slack::Event::GroupOpen;
Subroutine BEGIN: called CC=1 SCAR=0.0
84 2 ▶use Net::Async::Slack::Event::GroupRename;
Subroutine BEGIN: called CC=1 SCAR=0.0
85 2 ▶use Net::Async::Slack::Event::GroupUnarchive;
Subroutine BEGIN: called CC=1 SCAR=0.0
86 2 ▶use Net::Async::Slack::Event::Hello;
Subroutine BEGIN: called CC=1 SCAR=0.0
87 2 ▶use Net::Async::Slack::Event::ImClose;
Subroutine BEGIN: called CC=1 SCAR=0.0
88 2 ▶use Net::Async::Slack::Event::ImCreated;
Subroutine BEGIN: called CC=1 SCAR=0.0
89 2 ▶use Net::Async::Slack::Event::ImHistoryChanged;
Subroutine BEGIN: called CC=1 SCAR=0.0
90 2 ▶use Net::Async::Slack::Event::ImMarked;
Subroutine BEGIN: called CC=1 SCAR=0.0
91 2 ▶use Net::Async::Slack::Event::ImOpen;
Subroutine BEGIN: called CC=1 SCAR=0.0
92 2 ▶use Net::Async::Slack::Event::LinkShared;
Subroutine BEGIN: called CC=1 SCAR=0.0
93 2 ▶use Net::Async::Slack::Event::ManualPresenceChange;
Subroutine BEGIN: called CC=1 SCAR=0.0
94 2 ▶use Net::Async::Slack::Event::MemberJoinedChannel;
Subroutine BEGIN: called CC=1 SCAR=0.0
95 2 ▶use Net::Async::Slack::Event::MemberLeftChannel;
Subroutine BEGIN: called CC=1 SCAR=0.0
96 2 ▶use Net::Async::Slack::Event::MessageAppHome;
Subroutine BEGIN: called CC=1 SCAR=0.0
97 2 ▶use Net::Async::Slack::Event::MessageChannels;
Subroutine BEGIN: called CC=1 SCAR=0.0
98 2 ▶use Net::Async::Slack::Event::MessageGroups;
Subroutine BEGIN: called CC=1 SCAR=0.0
99 2 ▶use Net::Async::Slack::Event::MessageIm;
Subroutine BEGIN: called CC=1 SCAR=0.0
100 2 ▶use Net::Async::Slack::Event::MessageMpim;
Subroutine BEGIN: called CC=1 SCAR=0.0
101 2 ▶use Net::Async::Slack::Event::Message;
Subroutine BEGIN: called CC=1 SCAR=0.0
102 2 ▶use Net::Async::Slack::Event::PinAdded;
Subroutine BEGIN: called CC=1 SCAR=0.0
103 2 ▶use Net::Async::Slack::Event::PinRemoved;
Subroutine BEGIN: called CC=1 SCAR=0.0
104 2 ▶use Net::Async::Slack::Event::PrefChange;
Subroutine BEGIN: called CC=1 SCAR=0.0
105 2 ▶use Net::Async::Slack::Event::PresenceChange;
Subroutine BEGIN: called CC=1 SCAR=0.0
106 2 ▶use Net::Async::Slack::Event::PresenceQuery;
Subroutine BEGIN: called CC=1 SCAR=0.0
107 2 ▶use Net::Async::Slack::Event::PresenceSub;
Subroutine BEGIN: called CC=1 SCAR=0.0
108 2 ▶use Net::Async::Slack::Event::ReactionAdded;
Subroutine BEGIN: called CC=1 SCAR=0.0
109 2 ▶use Net::Async::Slack::Event::ReactionRemoved;
Subroutine BEGIN: called CC=1 SCAR=0.0
110 2 ▶use Net::Async::Slack::Event::ReconnectURL;
Subroutine BEGIN: called CC=1 SCAR=0.0
111 2 ▶use Net::Async::Slack::Event::ResourcesAdded;
Subroutine BEGIN: called CC=1 SCAR=0.0
112 2 ▶use Net::Async::Slack::Event::ResourcesRemoved;
Subroutine BEGIN: called CC=1 SCAR=0.0
113 2 ▶use Net::Async::Slack::Event::ScopeDenied;
Subroutine BEGIN: called CC=1 SCAR=0.0
114 2 ▶use Net::Async::Slack::Event::ScopeGranted;
Subroutine BEGIN: called CC=1 SCAR=0.0
115 2 ▶use Net::Async::Slack::Event::StarAdded;
Subroutine BEGIN: called CC=1 SCAR=0.0
116 2 ▶use Net::Async::Slack::Event::StarRemoved;
Subroutine BEGIN: called CC=1 SCAR=0.0
117 2 ▶use Net::Async::Slack::Event::SubteamCreated;
Subroutine BEGIN: called CC=1 SCAR=0.0
118 2 ▶use Net::Async::Slack::Event::SubteamMembersChanged;
Subroutine BEGIN: called CC=1 SCAR=0.0
119 2 ▶use Net::Async::Slack::Event::SubteamSelfAdded;
Subroutine BEGIN: called CC=1 SCAR=0.0
120 2 ▶use Net::Async::Slack::Event::SubteamSelfRemoved;
Subroutine BEGIN: called CC=1 SCAR=0.0
121 2 ▶use Net::Async::Slack::Event::SubteamUpdated;
Subroutine BEGIN: called CC=1 SCAR=0.0
122 2 ▶use Net::Async::Slack::Event::TeamDomainChange;
Subroutine BEGIN: called CC=1 SCAR=0.0
123 2 ▶use Net::Async::Slack::Event::TeamJoin;
Subroutine BEGIN: called CC=1 SCAR=0.0
124 2 ▶use Net::Async::Slack::Event::TeamMigrationStarted;
Subroutine BEGIN: called CC=1 SCAR=0.0
125 2 ▶use Net::Async::Slack::Event::TeamPlanChange;
Subroutine BEGIN: called CC=1 SCAR=0.0
126 2 ▶use Net::Async::Slack::Event::TeamPrefChange;
Subroutine BEGIN: called CC=1 SCAR=0.0
127 2 ▶use Net::Async::Slack::Event::TeamProfileChange;
Subroutine BEGIN: called CC=1 SCAR=0.0
128 2 ▶use Net::Async::Slack::Event::TeamProfileDelete;
Subroutine BEGIN: called CC=1 SCAR=0.0
129 2 ▶use Net::Async::Slack::Event::TeamProfileReorder;
Subroutine BEGIN: called CC=1 SCAR=0.0
130 2 ▶use Net::Async::Slack::Event::TeamRename;
Subroutine BEGIN: called CC=1 SCAR=0.0
131 2 ▶use Net::Async::Slack::Event::TokensRevoked;
Subroutine BEGIN: called CC=1 SCAR=0.0
132 2 ▶use Net::Async::Slack::Event::URLVerification;
Subroutine BEGIN: called CC=1 SCAR=0.0
133 2 ▶use Net::Async::Slack::Event::UserChange;
Subroutine BEGIN: called CC=1 SCAR=0.0
134 2 ▶use Net::Async::Slack::Event::UserResourceDenied;
Subroutine BEGIN: called CC=1 SCAR=0.0
135 2 ▶use Net::Async::Slack::Event::UserResourceGranted;
Subroutine BEGIN: called CC=1 SCAR=0.0
136 2 ▶use Net::Async::Slack::Event::UserResourceRemoved;
Subroutine BEGIN: called CC=1 SCAR=0.0
137 2 ▶use Net::Async::Slack::Event::UserTyping;
Subroutine BEGIN: called CC=1 SCAR=0.0
138  
139 2 ▶use Log::Any qw($log);
Subroutine BEGIN: called CC=1 SCAR=0.0
140  
141 2 my $json = JSON::MaybeXS->new;
142  
143 =head1 METHODS
144  
145 =head2 events
146  
147 This is the stream of events, as a L<Ryu::Source>.
148  
149 Example usage:
150  
151 $rtm->events
152 ->filter(type => 'message')
153 ->sprintf_methods('> %s', $_->text)
154 ->say
155 ->await;
156  
157 =cut
158  
159 0 ▶sub events {
Subroutine events: not called CC=2 SCAR=17.9
Pod documented
160 0 my ($self) = @_;
161 0 ▶ $self->{events} //= do {
Condition0%0/3
$self->{"events"} //= do { $self->ryu->source }
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"events"} //= do { $self->ryu->source }
$self->{"events"} do { $self->ryu->source }
Truth table0%0/3
A //= B
A= $self->{"events"}B= do { $self->ryu->source }
ABresult
1X1
011
000
162 0 $self->ryu->source
163 }
164 }
165  
166 =head2 send_message
167  
168 Sends a message to a user or channel.
169  
170 This is limited (by the Slack API) to the L<default message formatting mode|https://api.slack.com/docs/formatting>,
171 so it's only useful for simple messages.
172  
173 Takes the following named parameters:
174  
175 =over 4
176  
177 =item * id - custom message ID (optional)
178  
179 =item * channel - either a L<Net::Async::Slack::Channel> instance, or a channel ID
180  
181 =back
182  
183 =cut
184  
185 0 ▶sub send_message {
Subroutine send_message: not called CC=2 SCAR=17.9
Pod documented
186 0 my ($self, %args) = @_;
187 0 my $id = $self->next_id($args{id});
188 0 my $f = $self->loop->new_future;
189 $self->ws->send_frame(
190 buffer => $json->encode({
191 type => 'message',
192 id => $id,
193 channel => (ref $args{channel} ? $args{channel}->id : $args{channel}),
194 text => $args{text},
195 0 ▶ }),
Branch: 1 branch
BranchTrueFalseTotal
ref $args{'channel'} ? : 0 0 0
196 masked => 1
197 );
198 0 $self->{pending_message}{$id} = $f;
199 }
200  
201 =head1 METHODS - Internal
202  
203 You may not need to call these directly. If I'm wrong and you find yourself having
204 to do that, please complain via the usual channels.
205  
206 =head2 connect
207  
208 Establishes the connection. Called by the top-level L<Net::Async::Slack> instance.
209  
210 =cut
211  
212 0 ▶sub connect {
Subroutine connect: not called CC=2 SCAR=17.9
Pod documented
213 0 my ($self, %args) = @_;
214 0 ▶ my $uri = $self->wss_uri or die 'no websocket URI available';
Branch: 1 branch
BranchTrueFalseTotal
my $uri = $self->wss_uri or die "no websocket URI available" 0 0 0
215 $self->add_child(
216 0 $self->{ws} = Net::Async::WebSocket::Client->new(
217 on_frame => $self->curry::weak::on_frame,
218 )
219 );
220 0 $log->tracef('URL for websockets will be %s', "$uri");
221 $self->{ws}->connect(
222 0 url => "$uri",
223 )
224 }
225  
226 0 ▶sub on_frame {
Subroutine on_frame: not called CC=6 SCAR=37.4
Pod undocumented
227 0 my ($self, $ws, $bytes) = @_;
228 0 my $text = Encode::decode_utf8($bytes);
229  
230 # Empty frame is used for PING, send a response back
231 0 ▶ if(!length($text)) {
Branch: 1 branch
BranchTrueFalseTotal
if (not length $text) { } 0 0 0
232 0 $ws->send_frame('');
233 } else {
234 0 $log->tracef("<< %s", $text);
235 try {
236 0 my $data = $json->decode($text);
237 0 ▶ if(my $id = $data->{reply_to}) {
Branch: 2 branches
BranchTrueFalseTotal
if (my $id = $data->{'reply_to'}) { } 0 0 0
elsif (my $ev = 'Net::Async::Slack::EventType'->from_json($data)) { } 0 0 0
238 0 ▶ if(my $f = delete $self->{pending_message}{$id}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $f = delete $self->{'pending_message'}{$id}) { } 0 0 0
239 0 ▶ if($data->{ok}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($data->{'ok'}) { } 0 0 0
240 $f->done(
241 id => $id,
242 ts => $data->{ts},
243 text => $data->{text},
244 0 );
245 } else {
246 $f->fail(
247 'Failed to send message: ' . $data->{error}{msg},
248 'slack_rtm',
249 0 code => @{$data->{error}}{qw(code msg)}
250 );
251 }
252 } else {
253 # This can happen with the initial stream of events, so maybe
254 # a warning is not necessary.
255 0 $log->warnf('Had reply %s to message, but it was not listed as pending, content is %s', $id, $data);
256 }
257 } elsif(my $ev = Net::Async::Slack::EventType->from_json($data)) {
258 0 $log->tracef("Have event [%s], emitting", $ev->type);
259 0 $self->events->emit($ev);
260 } else {
261 0 $self->events->emit($data);
262 }
263 0 } catch {
264 0 $log->errorf("Exception in websocket raw frame handling: %s (original text %s)", $@, $text);
265 }
266 }
267 }
268  
269 0 ▶sub slack { shift->{slack} }
Subroutine slack: not called CC=1 SCAR=6.9
Pod undocumented
270  
271 0 ▶sub wss_uri { shift->{wss_uri} }
Subroutine wss_uri: not called CC=1 SCAR=6.9
Pod undocumented
272  
273 0 ▶sub ws { shift->{ws} }
Subroutine ws: not called CC=1 SCAR=6.9
Pod undocumented
274  
275 0 ▶sub ryu { shift->{ryu} }
Subroutine ryu: not called CC=1 SCAR=6.9
Pod undocumented
276  
277 0 ▶sub next_id {
Subroutine next_id: not called CC=2 SCAR=17.9
Pod undocumented
278 0 my ($self, $id) = @_;
279 0 ▶ $self->{last_id} = $id // ++$self->{last_id};
Condition0%0/2
$id // ++$self->{"last_id"}
l!l
00
MC/DC0%0/1
$id // ++$self->{"last_id"}
$id
Truth table0%0/2
A
A= $id
Aresult
11
00
280 }
281  
282 0 ▶sub configure {
Subroutine configure: not called CC=3 SCAR=24.8
Pod documented
283 0 my ($self, %args) = @_;
284 0 for my $k (qw(slack wss_uri)) {
285 0 ▶ $self->{$k} = delete $args{$k} if exists $args{$k};
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{$k} 0 0 0
286 }
287 0 $self->next::method(%args);
288 }
289  
290 0 ▶sub ping_timer {
Subroutine ping_timer: not called CC=2 SCAR=17.9
Pod undocumented
291 0 my ($self) = @_;
292 0 ▶ $self->{ping_timer} ||= do {
Condition0%0/3
$self->{"ping_timer"} ||= do { $self->add_child(my $timer = "IO::Async::Timer::Countdown"->new("delay", 10, "on_expire", $self->$curry::weak(sub { (shift())->trigger_ping; } ))); $timer }
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"ping_timer"} ||= do { $self->add_child(my $timer = "IO::Async::Timer::Countdown"->new("delay", 10, "on_expire", $self->$curry::weak(sub { (shift())->trigger_ping; } ))); $timer }
$self->{"ping_timer"} do { $self->add_child(my $timer = "IO::Async::Timer::Countdown"->new("delay", 10, "on_expire", $self->$curry::weak(sub { (shift())->trigger_ping; } ))); $timer }
Truth table0%0/3
A ||= B
A= $self->{"ping_timer"}B= do { $self->add_child(my $timer = "IO::Async::Timer::Countdown"->new("delay", 10, "on_expire", $self->$curry::weak(sub { (shift())->trigger_ping; } ))); $timer }
ABresult
1X1
011
000
293 $self->add_child(
294 my $timer = IO::Async::Timer::Countdown->new(
295 delay => 10,
296 0 ▶ on_expire => $self->$curry::weak(sub { shift->trigger_ping }),
Subroutine __ANON__: not called CC=1 SCAR=6.9
297 )
298 );
299 0 $timer
300 }
301 }
302  
303 0 ▶sub trigger_ping {
Subroutine trigger_ping: not called CC=2 SCAR=17.9
Pod undocumented
304 0 my ($self, %args) = @_;
305 0 my $id = $self->next_id($args{id});
306 0 $self->ws->send_frame(
307 buffer => $json->encode({
308 type => 'ping',
309 id => $id,
310 }),
311 masked => 1
312 );
313 0 $self->ping_timer->reset;
314 0 ▶ $self->ping_timer->start if $self->ping_timer->is_expired;
Branch: 1 branch
BranchTrueFalseTotal
if $self->ping_timer->is_expired 0 0 0
315 }
316  
317 0 ▶sub _add_to_loop {
Subroutine _add_to_loop: not called CC=2 SCAR=17.9
318 0 my ($self, $loop) = @_;
319 $self->add_child(
320 0 $self->{ryu} = Ryu::Async->new
321 );
322 0 $self->ping_timer->start;
323 0 ▶ $self->{last_id} //= 0;
Condition0%0/2
$self->{"last_id"} //= 0
l!l
00
MC/DC0%0/1
$self->{"last_id"} //= 0
$self->{"last_id"}
Truth table0%0/2
A
A= $self->{"last_id"}
Aresult
11
00
324 }
325  
326 2 1;
327  
328 =head1 AUTHOR
329  
330 Tom Molesworth <TEAM@cpan.org>
331  
332 =head1 LICENSE
333  
334 Copyright Tom Molesworth 2016-2024. Licensed under the same terms as Perl itself.
335  
« Slack/Event/Channel.pm ↑ Summary Slack/Event/Message.pm »