Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

63 lines (41 sloc) 1.177 kb

NAME

Object::Container::Namespace - Container with name space register

SYNOPSIS

    package  MyApp::Container;
    use strict;
    use warnings;
    use Object::Container::Namespace -base;
    register 'db' => sub {
        my $self = shift;
        MyApp::DB->new;
    };

    package  Hoge::Api::Wassr;
    use strict;
    use warnings;

    sub new {
        bless {},shift;
    }

    sub login { 'do something' }

    package  Hoge::Pages::Fuga;
    use strict;
    use warnings;
    use MyApp::Container qw/api/;

    sub dispatch_index {
        my $self = shift;

        #get registered object
        container('db')->search();

        #get registered object by namespace register
        api('wassr')->login('wasao');
        #call Hoge::Api::Twitter->login
        api('twitter')->login('tweet');
    }

DESCRIPTION

Object::Container::Namespace is Container with name space register

AUTHOR

Nishibayashi Takuji <takuji {at} senchan.jp>

SEE ALSO

Object::Container Kamui::Container

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Jump to Line
Something went wrong with that request. Please try again.