summaryrefslogtreecommitdiffstats
path: root/lib/MooseX/ABC/Role/Object.pm
blob: fd5638601c6b9782e5a4e2714907b417ef88134d (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
package MooseX::ABC::Role::Object;
use Moose::Role;
# ABSTRACT: base object role for L<MooseX::ABC>

=head1 DESCRIPTION

This is a base object role implementing the behavior of L<MooseX::ABC> classes
being uninstantiable.

=cut

around new => sub {
    my $orig = shift;
    my $class = shift;
    my $meta = Class::MOP::class_of($class);
    $meta->throw_error("$class is abstract, it cannot be instantiated")
        if $meta->is_abstract;
    $class->$orig(@_);
};

no Moose::Role;

1;