IOC/Service/Parameterized.pm

filter: Statementstmt 95.2% 20 / 21 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 100% 2 / 2 totaltotal 90.6% 29 / 32 CC 2 SCAR 3.2
CC
2
Cov
91%
instance
2.0
deferred
2.0
BEGIN
1.0
CRAP 1.4
« IOC/Service/Literal.pm ↑ Summary IOC/Service/Prototype.pm »
1  
2 package IOC::Service::Parameterized;
3  
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 our $VERSION = '0.01';
8  
9 3 ▶use Scalar::Util qw(blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 3 ▶use IOC::Exceptions;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 3 ▶use base 'IOC::Service::Prototype';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 6 ▶sub instance {
Subroutine instance: called CC=2 SCAR=7.1
Pod documented
16 6 my ($self, %params) = @_;
17 6 ▶ (defined($self->{container}))
Branch: 1 branch
BranchTrueFalseTotal
defined $self->{"container"} or "IOC::IllegalOperation"->throw("Cannot create a service instance without setting container") 6 0 6
18 || throw IOC::IllegalOperation "Cannot create a service instance without setting container";
19 # we need to be sure to not store this value
20 # otherwise we will add a ref count to it
21 6 return $self->{block}->($self->{container}, %params);
22 }
23  
24 0 ▶sub deferred {
Subroutine deferred: not called CC=1 SCAR=6.9
Pod documented
25 0 throw IOC::IllegalOperation "Parameterized services cannot be deferred";
26 }
27  
28 3 1;
29  
30 __END__
« IOC/Service/Literal.pm ↑ Summary IOC/Service/Prototype.pm »