| 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.006'; # 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 | sub new { | ||||||||||||||||||||||||||||
| 14 | 0 | ▶ | my $class = shift; | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 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 | sub update { | ||||||||||||||||||||||||||||
| 25 | 0 | ▶ | my ($self, %args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
update: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 26 | 0 | ▶ | die 'You need to pass either text or attachments' unless $args{text} || $args{attachments}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args{"text"} or $args{"attachments"}
MC/DC0%0/2
$args{"text"} or $args{"attachments"}
$args{"text"}
$args{"attachments"}
Truth table0%0/3
A or B
A= $args{"text"}B= $args{"attachments"}
| |||||||||||||||||||||||||||||
| 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 | ▶ | $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"}
| |||||||||||||||||||||||||||||
| 37 | 0 | push @content, $_ => $args{$_} for grep exists $args{$_}, qw(parse link_names unfurl_links unfurl_media as_user reply_broadcast); | |||||||||||||||||||||||||||
| 38 | 0 | $self->slack->http_post( | |||||||||||||||||||||||||||
| 39 | $self->slack->endpoint( | ||||||||||||||||||||||||||||
| 40 | 'chat.update', | ||||||||||||||||||||||||||||
| 41 | ), | ||||||||||||||||||||||||||||
| 42 | \@content, | ||||||||||||||||||||||||||||
| 43 | ) | ||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 2 | 1; | |||||||||||||||||||||||||||