add(%args) Register objects to container.
package MyContainer;
parent 'Micro::Container';
__PACKAGE__->register(
'LWP::UserAgent' => [ agent => 'FooBar' ],
JSON => sub {
my $c = shift;
$c->load_class('JSON')->new->utf8;
},
);
unregister(@names)
=head2 remove(@names)
Remove registered objects by name.
MyContainer->unregister('JSON', 'LWP::UserAgent');
get($name)
Get registered method.
my $json = MyContainer->get('JSON');
load_class($class, $prefix)
Constructs a class name and "require" the class.
Taken from Plack::Util.
$class = MyContainer->load_class('Foo'); # Foo
$class = MyContainer->load_class('Baz', 'Foo::Bar'); # Foo::Bar::Baz
$class = MyContainer->load_class('+XYZ::ZZZ', 'Foo::Bar'); # XYZ::ZZZ
AUTHOR xaicron <xaicron@cpan.org>
COPYRIGHT Copyright 2013 - xaicron
LICENSE This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO Object::Container.
Plack::Util.