package Catalyst::IOC::Container;
-use Bread::Board;
+use Bread::Board qw/depends_on/;
use Moose;
use Config::Any;
use Data::Visitor::Callback;
default => sub { +{} },
);
-has application_name => (
- is => 'ro',
- isa => 'Str',
- required => 1,
-);
-
has sub_container_class => (
isa => LoadableClass,
is => 'ro',
block => sub {
my $self = shift;
my $class = $self->param('application_name');
+ my $home;
if ( my $env = Catalyst::Utils::env_value( $class, 'HOME' ) ) {
$home = $env;
}
$home ||= Catalyst::Utils::home($class);
-
return $home;
},
dependencies => [ depends_on('application_name') ],
);
}
-# FIXME: very ambiguous - maybe root_dir?
-sub build_root_service {
+sub build_root_dir_service {
my $self = shift;
return Bread::Board::BlockInjection->new(
lifecycle => 'Singleton',
- name => 'root',
+ name => 'root_dir',
block => sub {
my $self = shift;
sub build_application_name_service {
my $self = shift;
- return Bread::Board::Literal->new( name => 'application_name', value => $self->application_name );
+ return Bread::Board::Literal->new( name => 'application_name', value => $self->name );
}
sub build_driver_service {
return Devel::InnerPackage::list_packages( $module );
}
+__PACKAGE__->meta->make_immutable;
+
1;
__END__