lib/Myriad/Subscription.pm

filter: Statementstmt 66.6% 16 / 24 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 1 totaltotal 51.2% 20 / 39 CC 4 SCAR 23.5
CC
4
Cov
52%
new
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 10.5
« lib/Myriad/UI/Readline.pm ↑ Summary lib/Myriad/Storage.pm »
1 package Myriad::Subscription;
2  
3 1 ▶use Myriad::Class class => '';
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 our $VERSION = '1.001'; # VERSION
6 1 our $AUTHORITY = 'cpan:DERIV'; # AUTHORITY
7  
8 =encoding utf8
9  
10 =head1 NAME
11  
12 Myriad::Subscription - microservice subscription abstraction
13  
14 =head1 SYNOPSIS
15  
16 my $sub = Myriad::Subscription->new();
17  
18 =head1 DESCRIPTION
19  
20 =cut
21  
22 1 ▶no indirect qw(fatal);
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 ▶use Scalar::Util qw(weaken);
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 1 ▶use Myriad::Exception::Builder category => 'subscription';
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 =head1 Exceptions
28  
29 =head2 UnknownTransport
30  
31 Subscription transport does not exist.
32  
33 =cut
34  
35 1 declare_exception UnknownTransport => (
36 message => 'Unknown transport'
37 );
38  
39 0 ▶sub new ($class, %args) {
Subroutine new: not called CC=4 SCAR=30.0
Pod undocumented
40 0 my $transport = delete $args{transport};
41 0 weaken(my $myriad = delete $args{myriad});
42  
43 # Passing args individually looks tedious but this is to avoid
44 # L<IO::Async::Notifier> exception when it doesn't recognize the key.
45  
46 0 ▶ if ($transport eq 'redis') {
Branch: 2 branches
BranchTrueFalseTotal
if ($transport eq 'redis') { } 0 0 0
elsif ($transport eq 'memory' or $transport eq 'perl') { } 0 0 0
47 0 require Myriad::Subscription::Implementation::Redis;
48 0 return Myriad::Subscription::Implementation::Redis->new(
49 redis => $myriad->redis_transport,
50 );
51 ▶ } elsif ($transport eq 'memory' or $transport eq 'perl') {
Condition0%0/3
$transport eq "memory" or $transport eq "perl"
l!l&&r!l&&!r
000
MC/DC0%0/2
$transport eq "memory" or $transport eq "perl"
$transport eq "memory" $transport eq "perl"
Truth table0%0/3
A or B
A= $transport eq "memory"B= $transport eq "perl"
ABresult
1X1
011
000
52 0 require Myriad::Subscription::Implementation::Memory;
53 0 return Myriad::Subscription::Implementation::Memory->new(
54 transport => $myriad->memory_transport
55 );
56 } else {
57 0 Myriad::Exception::Subscription::UnknownTransport->throw();
58 }
59 }
60  
61 1 1;
62  
63 __END__
« lib/Myriad/UI/Readline.pm ↑ Summary lib/Myriad/Storage.pm »