Board/Service/Alias.pm

filter: Statementstmt 100% 22 / 22 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 96.6% 29 / 30 CC 2 SCAR 2.5
CC
2
Cov
96%
_build_aliased_from
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« Board/Service/WithParameters.pm ↑ Summary Board/BlockInjection.pm »
1 package Bread::Board::Service::Alias;
2 55 our $AUTHORITY = 'cpan:STEVAN';
3 # ABSTRACT: aliases another service
4 55 $Bread::Board::Service::Alias::VERSION = '0.37';
5 55 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 55 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 55 has aliased_from_path => (
10 is => 'ro',
11 isa => 'Str',
12 );
13  
14 55 has aliased_from => (
15 is => 'ro',
16 does => 'Bread::Board::Service',
17 lazy => 1,
18 builder => '_build_aliased_from',
19 handles => ['get'], # is this sufficient?
20 );
21  
22 55 with 'Bread::Board::Service';
23  
24 24 ▶sub _build_aliased_from {
Subroutine _build_aliased_from: called CC=2 SCAR=7.0
25 24 my $self = shift;
26  
27 24 my $path = $self->aliased_from_path;
28 24 ▶ confess "Can't create an alias service without a service to alias from"
Branch: 1 branch
BranchTrueFalseTotal
unless $path 0 24 24
29 unless $path;
30  
31 24 ▶ return try {
Subroutine __ANON__: called CC=1 SCAR=0.0
32 24 $self->fetch($path);
33 }
34 1 ▶ catch {
Subroutine __ANON__: called CC=1 SCAR=0.0
35 1 die "While resolving alias " . $self->name . ": $_";
36 24 };
37 }
38  
39 55 __PACKAGE__->meta->make_immutable;
40  
41 55 ▶no Moose; 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
42  
43 __END__
« Board/Service/WithParameters.pm ↑ Summary Board/BlockInjection.pm »