| 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
| |||||||||||||
| 23 | |||||||||||||
| 24 | 8 | ▶ | my $name = $self->{name} // '(unknown)'; | ||||||||||
|
Condition50%1/2
$self->{"name"} // "(unknown)"
MC/DC0%0/1
$self->{"name"} // "(unknown)"
$self->{"name"}
Truth table50%1/2
A
A= $self->{"name"}
| |||||||||||||
| 25 | 8 | ▶ | my $reason = $self->{reason} // '(unknown reason)'; | ||||||||||
|
Condition50%1/2
$self->{"reason"} // "(unknown reason)"
MC/DC0%0/1
$self->{"reason"} // "(unknown reason)"
$self->{"reason"}
Truth table50%1/2
A
A= $self->{"reason"}
| |||||||||||||
| 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__ | ||||||||||||