summaryrefslogtreecommitdiffstats
path: root/lib/MooseX/Bread/Board/Role/Object.pm
blob: 552bc75903ed1480bf9d3cca7ecf4e9b8ff44349 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package MooseX::Bread::Board::Role::Object;
use Moose::Role;
use Bread::Board;

has name => (
    is      => 'rw',
    isa     => 'Str',
    lazy    => 1,
    default => sub { shift->meta->name },
);

sub BUILD { }
after BUILD => sub {
    my $self = shift;

    my $meta = Class::MOP::class_of($self);
    return unless $meta->has_services;

    for my $service ($meta->services) {
        $self->add_service($service->clone);
    }
};

no Bread::Board;
no Moose::Role;

1;