How to do it - Bread::Board
file: code/BreadBoard/MyBB.pm
1: package MyBB;
2: use 5.014;
3: use Bread::Board;
4:
5: sub setup {
6: my ($class) = @_;
7:
8: return container 'CouchPotatoe' => as {
9: service 'FindNewSeries' => (
10: class => 'FindNewSeries',
11: dependencies => {
12: ua => '/Component/LWP-UserAgent',
13: formatter => '/Component/Number-Format',
14: renderer => '/Component/TT',
15: }
16: );
17: container 'Component' => as {
18: service 'LWP-UserAgent' => (
19: class => 'LWP::UserAgent',
20: lifecycle => 'Singleton',
21: );
22: service 'Number-Format' => (
23: class => 'Number::Format',
24: lifecycle => 'Singleton',
25: );
26: service 'TT' => (
27: class => 'Template',
28: lifecycle => 'Singleton',
29: block => sub {
30: return Template->new(
31: INCLUDE_PATH => $FindBin::Bin . '/../tt/' );
32: },
33: );
34: };
35: };
36: }
37:
38: 1;