WebApi.pm

filter: Statementstmt 100% 36 / 36 Branchbran 100% 2 / 2 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 10 / 10 Podpod n/a totaltotal 100% 53 / 53 CC 3 SCAR 4.1
CC
3
Cov
100%
_build_client
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.5
« WebApi/Chat.pm ↑ Summary WebApi/Generator.pm »
1 package WebService::Slack::WebApi;
2 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 5 ▶use Class::Load qw/ load_class /;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 5 ▶use Class::Accessor::Lite::Lazy (
Subroutine BEGIN: called CC=1 SCAR=0.0
8 5 new => 1,
9 rw => [qw/ team_domain token opt ua /],
10 ro_lazy => [qw/ client api auth channels conversations chat dialog emoji files groups im oauth pins reactions rtm search stars team users dnd bots migration /],
11 5 );
12  
13 5 ▶use WebService::Slack::WebApi::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 5 ▶use WebService::Slack::WebApi::Client;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 5 our $VERSION = '0.19';
17  
18 12 ▶sub _build_client {
Subroutine _build_client: called CC=3 SCAR=11.0
19 12 my $self = shift;
20 12 ▶ if( $self->opt && $self->ua ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->opt and $self->ua) 1 11 12
Condition100%3/3
$self->opt and $self->ua
!ll&&!rl&&r
831
MC/DC100%2/2
$self->opt and $self->ua
$self->opt $self->ua
Truth table100%3/3
A and B
A= $self->optB= $self->ua
ABresult
0X0
100
111
21 1 WebService::Slack::WebApi::Exception::IllegalParameters->throw(
22 message => 'Illegal parameters. You cannot use both parameters \'opt\' and \'ua\' together',
23 );
24 }
25 11 return WebService::Slack::WebApi::Client->new(
26 team_domain => $self->team_domain,
27 token => $self->token,
28 opt => $self->opt,
29 useragent => $self->ua,
30 );
31 }
32  
33 5 for my $class_name (qw/ api auth channels conversations chat dialog emoji files groups im oauth pins reactions rtm search stars team users dnd bots migration /) {
34 105 my $method = sprintf '%s::_build_%s', __PACKAGE__, $class_name;
35 105 my $class = sprintf '%s::%s', __PACKAGE__, ucfirst($class_name);
36  
37 5 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
38 43 ▶ *$method = sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
39 43 load_class $class;
40 43 return $class->new(client => shift->client)
41 105 };
42 }
43  
44 5 1;
45  
46 __END__
« WebApi/Chat.pm ↑ Summary WebApi/Generator.pm »