Cole - Lightweight DI container
$ioc = Cole->new;
$ioc->register('class name', class => 'Foo');
$ioc->register('string', 'Hello, world!');
$ioc->register('instance', Foo->new);
$ioc->register('dependency', class => 'Bar', deps => 'foo');
$ioc->register(
'multiple dependencies',
class => 'Baz',
deps => ['foo', 'bar']
);Cole is a lightweight Dependency Injection container.
$ioc->register(string => {value => 'Hello world!'});
$ioc->register(instance => {value => Foo->new});$ioc->register(class => {class => 'Foo'});$ioc->register(class => {class => 'Foo', deps => 'bar'});$ioc->register(bar => {class => 'Bar'});
$ioc->register(class => {class => 'Foo', deps => {bar => 'baz'}});bar is passed as baz during Foo creation.
my $ioc = Cole->new;$ioc->register(name => {class => 'foo'});Register a new dependency.
$ioc->get('name');Return an instance of a service by name.
http://github.com/vti/coleViacheslav Tykhanovskyi, vti@cpan.org.
Copyright (C) 2011, Viacheslav Tykhanovskyi
This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.