Mercurial > pub > Impl
diff lib/IMPL/Config/Container.pm @ 422:b0481c071bea ref20150831
IMPL::Config::Container tests, YAMLConfiguration now works and tested
author | cin |
---|---|
date | Sun, 20 Aug 2017 00:20:41 +0300 |
parents | 7798345304bc |
children |
line wrap: on
line diff
--- a/lib/IMPL/Config/Container.pm Sun Jul 16 22:59:39 2017 +0300 +++ b/lib/IMPL/Config/Container.pm Sun Aug 20 00:20:41 2017 +0300 @@ -1,6 +1,6 @@ package IMPL::Config::Container; use strict; - +use mro; use Scalar::Util qw(blessed); use IMPL::Exception(); use IMPL::lang qw(:base); @@ -17,12 +17,13 @@ 'IMPL::Object::Disposable' => undef ], props => [ - roles => 'r', - services => 'r', - instances => 'r', - parent => 'r', - root => 'r', - loader => 'r' + roles => 'r', + services => 'r', + serviceCache => 'r', + instances => 'r', + parent => 'r', + root => 'r', + loader => 'r' ] }; @@ -46,6 +47,8 @@ $this->services( Bag->new() ); $this->root($this); } + + $this->services->tag($this); } sub Dispose { @@ -57,6 +60,8 @@ &$d($v); } } + + $this->next::method(); } sub Require { @@ -90,14 +95,12 @@ } sub Resolve { - my ( $this, $role, %opts ) = @_; + my ( $this, $role ) = @_; my $descriptor = $this->services->Resolve($role); - return $descriptor->Activate( ActivationContext->new($this) ) + return ActivationContext->new($this)->Activate($descriptor) if $descriptor; - - return $opts{default} if exists $opts{default}; } sub ResolveAll { @@ -113,7 +116,7 @@ $context = ActivationContext->new($this) unless $context && $opts{shared}; - push @result, $service->Activate($context); + push @result, $context->Activate($service); } return \@result;