| 1 | |||||||||||||||||||||
| 2 | package IOC::Service::Literal; | ||||||||||||||||||||
| 3 | |||||||||||||||||||||
| 4 | 10 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 10 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 10 | our $VERSION = '0.01'; | |||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 10 | ▶ | use Scalar::Util qw(blessed); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 10 | ▶ | use IOC::Exceptions; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 10 | ▶ | use base 'IOC::Service'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 9 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||
| 16 | 9 | my ($_class, $name, $literal) = @_; | |||||||||||||||||||
| 17 | 9 | ▶ | my $class = ref($_class) || $_class; | ||||||||||||||||||
|
Condition33%1/3
ref $_class || $_class
MC/DC0%0/2
ref $_class || $_class
ref $_class
$_class
Truth table33%1/3
A || B
A= ref $_classB= $_class
| |||||||||||||||||||||
| 18 | 9 | my $service = {}; | |||||||||||||||||||
| 19 | 9 | bless($service, $class); | |||||||||||||||||||
| 20 | 9 | $service->_init($name, $literal); | |||||||||||||||||||
| 21 | 7 | return $service; | |||||||||||||||||||
| 22 | } | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | 9 | ▶ | sub _init { | ||||||||||||||||||
|
Subroutine
_init: called CC=3 SCAR=11.0
| |||||||||||||||||||||
| 25 | 9 | my ($self, $name, $literal) = @_; | |||||||||||||||||||
| 26 | 9 | ▶ | (defined($name)) || throw IOC::InsufficientArguments "Service object cannot be created without a name"; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 27 | 8 | ▶ | (defined($literal)) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 28 | || throw IOC::InsufficientArguments "Service::Literal object cannot be created without value"; | ||||||||||||||||||||
| 29 | # set the defaults | ||||||||||||||||||||
| 30 | 7 | $self->{_instance} = $literal; | |||||||||||||||||||
| 31 | # assign constructor args | ||||||||||||||||||||
| 32 | 7 | $self->{name} = $name; | |||||||||||||||||||
| 33 | # No block in this one | ||||||||||||||||||||
| 34 | ## $self->{block} = undef; | ||||||||||||||||||||
| 35 | # No container in this one either | ||||||||||||||||||||
| 36 | ## $self->{container} = undef; | ||||||||||||||||||||
| 37 | } | ||||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | 15 | ▶ | sub instance { (shift)->{_instance} } | ||||||||||||||||||
|
Subroutine
instance: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | # no-ops | ||||||||||||||||||||
| 42 | 7 | ▶ | sub setContainer { () } | ||||||||||||||||||
|
Subroutine
setContainer: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 43 | 1 | ▶ | sub removeContainer { () } | ||||||||||||||||||
|
Subroutine
removeContainer: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 44 | 3 | ▶ | sub DESTROY { () } | ||||||||||||||||||
|
Subroutine
DESTROY: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 10 | 1; | |||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | __END__ | ||||||||||||||||||||