Concierge/Desk/UnavailableComponent.pm

filter: Statementstmt 100% 13 / 13 Branchbran 50.0% 1 / 2 Conditioncond 50.0% 2 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 76.9% 20 / 26 CC 4 SCAR 10.4
CC
4
Cov
84%
AUTOLOAD
4.2
BEGIN
1.0
new
1.0
CRAP 2.8
« Concierge/Desk/User.pm ↑ Summary Concierge/Desk/DeferredComponent.pm »
1 package Concierge::Desk::UnavailableComponent v0.13.0;
2 2 ▶use v5.36;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 2 our $VERSION = 'v0.13.0';
5  
6 # ABSTRACT: Stand-in substituted for a failed optional Concierge desk component
7  
8 2 our $AUTOLOAD;
9  
10 5 ▶sub new ($class, %args) {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
11 return bless {
12 name => $args{name},
13 reason => $args{reason},
14 5 }, $class;
15 }
16  
17 8 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: called CC=4 SCAR=14.3
18 8 my $self = shift;
19  
20 8 my $called = $AUTOLOAD;
21 8 $called =~ s/.*:://;
22 8 ▶ return if $called eq 'DESTROY';
Branch: 1 branch
BranchTrueFalseTotal
if $called eq "DESTROY" 0 8 8
23  
24 8 ▶ my $name = $self->{name} // '(unknown)';
Condition50%1/2
$self->{"name"} // "(unknown)"
l!l
80
MC/DC0%0/1
$self->{"name"} // "(unknown)"
$self->{"name"}
Truth table50%1/2
A
A= $self->{"name"}
Aresult
11
00
25 8 ▶ my $reason = $self->{reason} // '(unknown reason)';
Condition50%1/2
$self->{"reason"} // "(unknown reason)"
l!l
80
MC/DC0%0/1
$self->{"reason"} // "(unknown reason)"
$self->{"reason"}
Truth table50%1/2
A
A= $self->{"reason"}
Aresult
11
00
26  
27 return {
28 8 success => 0,
29 message => "Component '$name' unavailable: $reason",
30 };
31 }
32  
33 # Explicit no-op DESTROY. Without this, object teardown would invoke
34 # AUTOLOAD for 'DESTROY' (Perl calls AUTOLOAD for a missing DESTROY just
35 # like any other missing method); the 'return if DESTROY' guard above
36 # only prevents AUTOLOAD from returning a failure hashref in that case,
37 # it does not avoid the AUTOLOAD call itself. A real DESTROY here is
38 # cheaper and clearer than relying on that guard.
39 0 ▶sub DESTROY { }
Subroutine DESTROY: not called CC=1 SCAR=0.0
40  
41 2 1;
42  
43 __END__
« Concierge/Desk/User.pm ↑ Summary Concierge/Desk/DeferredComponent.pm »