Skip to content

Instantly share code, notes, and snippets.

@domm
Created December 1, 2014 11:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save domm/af231b16521e05943c5c to your computer and use it in GitHub Desktop.
Save domm/af231b16521e05943c5c to your computer and use it in GitHub Desktop.
container 'Config' => as {
service 'config' => (
lifecycle => "Singleton",
class => 'Config::JFDI',
dependencies => {
name => service( name => "your_app_name" ),
path => '/Path/etc',
},
);
};
container 'SomethingNeedingConfig' => as {
service 'some_service' => (
lifecycle => "Singleton",
class => 'Some::Class',
dependencies => { config => '/Config/config' },
block => sub {
my $s = shift;
my $from_config = $s->param('config')
->get->{'some'}{'key'};
return Some::Class->new( foo => $from_config);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment