# HG changeset patch # User cin # Date 1451304695 -10800 # Node ID 3f38dabaf5cc42a13ce89afbdb58b4c840a44ca6 # Parent 3ed0c58e9da3d2cf7996f8458dad5103dd41a146 sync diff -r 3ed0c58e9da3 -r 3f38dabaf5cc _test/Test/Config/Container.pm --- a/_test/Test/Config/Container.pm Mon Nov 02 01:56:53 2015 +0300 +++ b/_test/Test/Config/Container.pm Mon Dec 28 15:11:35 2015 +0300 @@ -20,7 +20,8 @@ use IMPL::declare { require => { - Container => 'IMPL::Config::Container' + Container => 'IMPL::Config::Container', + }, base => { 'IMPL::Test::Unit' => '@_' @@ -32,9 +33,21 @@ my $c1 = Container->new(); }; -sub RegisterServices { +test RegisterServices => sub { my $c1 = Container->new(); -} + + $c1->Register( 'db' => Service->new( + type => 'Foo::Data', + norequire => 1, + activation => 'container' + )); + + return $c1; +}; + +test ResolveServices => sub { + +}; 1; \ No newline at end of file diff -r 3ed0c58e9da3 -r 3f38dabaf5cc _test/any.pl --- a/_test/any.pl Mon Nov 02 01:56:53 2015 +0300 +++ b/_test/any.pl Mon Dec 28 15:11:35 2015 +0300 @@ -1,6 +1,6 @@ #!/usr/bin/perl -w use strict; -use lib '..\Lib'; +use lib '..\lib'; require IMPL::DOM::Navigator::SimpleBuilder; require IMPL::DOM::XMLReader; diff -r 3ed0c58e9da3 -r 3f38dabaf5cc _test/run_tests.pl --- a/_test/run_tests.pl Mon Nov 02 01:56:53 2015 +0300 +++ b/_test/run_tests.pl Mon Dec 28 15:11:35 2015 +0300 @@ -2,7 +2,7 @@ use strict; use warnings; -use lib '../Lib'; +use lib '../lib'; use lib '.'; use IMPL::Test::HarnessRunner; diff -r 3ed0c58e9da3 -r 3f38dabaf5cc _test/sample.yaml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/_test/sample.yaml Mon Dec 28 15:11:35 2015 +0300 @@ -0,0 +1,20 @@ +include: +- secrets.yaml +- defaults.yaml +services: +- role: db + type: My::Db::Context +- role: + - auth + - authz + - users-provider + - roles-provider + type: My::LDAP::Adapter +- role: security-provider + type: My::SecureCookies + params: + users: + $ref: users-provider + roles: + $ref: roles-provider + persistent: 0 \ No newline at end of file diff -r 3ed0c58e9da3 -r 3f38dabaf5cc _test/temp.pl --- a/_test/temp.pl Mon Nov 02 01:56:53 2015 +0300 +++ b/_test/temp.pl Mon Dec 28 15:11:35 2015 +0300 @@ -3,9 +3,9 @@ use Carp; use Time::HiRes qw(gettimeofday tv_interval); use Scalar::Util qw(blessed refaddr); -use YAML::XS qw(Dump); +use YAML::XS qw(Dump Load); -my $t = [gettimeofday]; + use IMPL::require { Container => 'IMPL::Config::Container', @@ -14,36 +14,19 @@ Value => 'IMPL::Config::ValueDescriptor' }; -my $c1 = Container->new(); - -$c1->Register('db', Service->new( - type => 'Foo::Data', - norequire => 1, - activation => 'container' -) ); - -$c1->Register(['sec', 'ldap'], Reference->new('db') ); +my $data; +{ + open my $h, "sample.yaml" or die; + binmode $h; + local $/; + $data = <$h>; +} -$c1->Register('mixed', Value->new([ - Reference->new('db'), - Reference->new('sec'), - Reference->new('ldap') -])); +my $t = [gettimeofday]; -my $c2 = Container->new($c1); - -my $data = [ $c1->Resolve('mixed')] ; +print Dump Load($data); print "Activated: ",tv_interval($t,[gettimeofday]),"\n"; -print Dump($data); - - -package Foo::Data; -use IMPL::declare { - base => [ - 'IMPL::Object' => undef - ] -}; 1; diff -r 3ed0c58e9da3 -r 3f38dabaf5cc impl.komodoproject --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/impl.komodoproject Mon Dec 28 15:11:35 2015 +0300 @@ -0,0 +1,21 @@ + + + + + + + + 1 + None + None + lib + 1 + + + + + Perl - TAP (*.t) + + + + diff -r 3ed0c58e9da3 -r 3f38dabaf5cc lib/IMPL/Config/Container.pm --- a/lib/IMPL/Config/Container.pm Mon Nov 02 01:56:53 2015 +0300 +++ b/lib/IMPL/Config/Container.pm Mon Dec 28 15:11:35 2015 +0300 @@ -6,7 +6,6 @@ use IMPL::declare { require => { Descriptor => 'IMPL::Config::Descriptor', - ValueDescriptor => 'IMPL::Config::ValueDescriptor', ActivationContext => 'IMPL::Config::ActivationContext', Hierarchy => 'IMPL::Config::Hierarchy', Bag => 'IMPL::Config::Bag', @@ -107,6 +106,24 @@ return \@result; } +sub Configure { + my ($this, $config) = @_; + + if (isarray($config)) { + $this->Configure($_) foreach @$config; + } elsif (ishash($config)) { + + } else { + die IMPL::ArgumentException->new(config => 'Either a hash or an array is required'); + } +} + +sub ParseDescriptor { + my ($this, $data) = @_; + + if () +} + 1; __END__ diff -r 3ed0c58e9da3 -r 3f38dabaf5cc lib/IMPL/Config/YAMLConfig.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/IMPL/Config/YAMLConfig.pm Mon Dec 28 15:11:35 2015 +0300 @@ -0,0 +1,16 @@ +package IMPL::Config::YAMLConfig; +use strict; + +sub Configure { + my ($this, $container, $config) = @_; + +} + +1; + +__END__ + +=pod + + +=cut \ No newline at end of file