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