IOC/Service/Prototype.pm

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