| 1 | package Net::Async::Slack::Message; | ||||||||||||||||||||||||||||||||||||||||||
| 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 Scalar::Util qw(weaken); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use JSON::MaybeXS; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | my $json = JSON::MaybeXS->new; | |||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | my $self = bless { @_ }, $class; | |||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | weaken $self->{slack}; | |||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | $self | |||||||||||||||||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | ▶ | sub slack { shift->{slack} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
slack: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | sub channel { shift->{channel} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
channel: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | sub thread_ts { shift->{thread_ts} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
thread_ts: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | sub update { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
update: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | die 'You need to pass either text or attachments' unless $args{text} || $args{attachments} || $args{blocks}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$args{"text"} or $args{"attachments"} or $args{"blocks"}
$args{"text"} or $args{"attachments"}
MC/DC0%0/3
$args{"text"} or $args{"attachments"} or $args{"blocks"}
$args{"text"}
$args{"attachments"}
$args{"blocks"}
Truth table0%0/4
A or B or C
A= $args{"text"}B= $args{"attachments"}C= $args{"blocks"}
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | $args{text} //= ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args{"text"} //= ""
MC/DC0%0/1
$args{"text"} //= ""
$args{"text"}
Truth table0%0/2
A
A= $args{"text"}
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | my @content; | |||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | push @content, token => $self->slack->token; | |||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | push @content, channel => $self->channel; | |||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | push @content, ts => $self->thread_ts; | |||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | push @content, text => $args{text} if defined $args{text}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | push @content, attachments => $json->encode($args{attachments}) if $args{attachments}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | push @content, blocks => $json->encode($args{blocks}) if $args{blocks}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | $args{as_user} //= 'true'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args{"as_user"} //= "true"
MC/DC0%0/1
$args{"as_user"} //= "true"
$args{"as_user"}
Truth table0%0/2
A
A= $args{"as_user"}
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | push @content, $_ => $args{$_} for grep exists $args{$_}, qw(parse link_names unfurl_links unfurl_media as_user reply_broadcast); | |||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | $self->slack->http_post( | |||||||||||||||||||||||||||||||||||||||||
| 40 | $self->slack->endpoint( | ||||||||||||||||||||||||||||||||||||||||||
| 41 | 'chat_update', | ||||||||||||||||||||||||||||||||||||||||||
| 42 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 43 | \@content, | ||||||||||||||||||||||||||||||||||||||||||
| 44 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||