| 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
| |||||||||||
| 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__ | ||||||||||