}
$caller->arguments( [@arguments] );
+
+ # FIXME
+ # what is this for?
+ # we call setup_home on import AND on ->setup
+ # is there a reason for it?
+ # anyway there is no point for setup_home without setup_config() so...
+ $caller->setup_config;
$caller->setup_home;
}
=cut
sub setup_home {
- my ( $class, $home ) = @_;
-
- if ( my $env = Catalyst::Utils::env_value( $class, 'HOME' ) ) {
- $home = $env;
- }
+ my ( $class, $home_flag ) = @_;
- $home ||= Catalyst::Utils::home($class);
+ my $home = $class->container->resolve(
+ service => 'home',
+ parameters => {
+ home_flag => $home_flag
+ },
+ );
if ($home) {
#I remember recently being scolded for assigning config values like this
$class->config->{home} ||= $home;
- $class->config->{root} ||= Path::Class::Dir->new($home)->subdir('root');
+ $class->config->{root} ||= $class->container->resolve(service => 'root_dir');
}
}
config_local_suffix
config_path
locate_components
+ home
+ root_dir
/;
my $config = $self->resolve( service => 'config' );
lifecycle => 'Singleton',
name => 'home',
block => sub {
- my $self = shift;
+ my $self = shift;
my $class = $self->param('catalyst_application');
- my $home;
if ( my $env = Catalyst::Utils::env_value( $class, 'HOME' ) ) {
- $home = $env;
+ return $env;
+ }
+
+ if ( my $home = $self->param('home_flag') ) {
+ return $home;
}
- $home ||= Catalyst::Utils::home($class);
- return $home;
+ return Catalyst::Utils::home($class);
+ },
+ parameters => {
+ home_flag => { is => 'ro', isa => 'Str|Undef', required => 0 }
},
dependencies => [ depends_on('catalyst_application') ],
);