Add date for first release
[gitmo/MooseX-StrictConstructor.git] / lib / MooseX / Object / StrictConstructor.pm
CommitLineData
32726d88 1package MooseX::Object::StrictConstructor;
2
3use strict;
4use warnings;
5
6use Moose;
7
8use Carp 'confess';
9
10extends 'Moose::Object';
11
12after 'BUILDALL' => sub
13{
14 my $self = shift;
15 my $params = shift;
16
17 my %attrs = map { $_->name() => 1 } $self->meta()->compute_all_applicable_attributes();
18
19 my @bad = grep { ! $attrs{$_} } keys %{ $params };
20
21 if (@bad)
22 {
23 confess "Found unknown attribute(s) passed to the constructor: @bad";
24 }
25
26 return;
27};
28
29
301;
2ffa7b60 31
32__END__
33
34=pod
35
36=head1 NAME
37
38MooseX::Object::StrictConstructor - Implements strict constructors as a Moose::Object subclass
39
40=head1 DESCRIPTION
41
42This class has no external interface. When you use
43C<MooseX::StrictConstructor>, your objects will subclass this class
44rather than Moose::Object.
45
46=head1 AUTHOR
47
48Dave Rolsky, C<< <autarch@urth.org> >>
49
50=head1 COPYRIGHT & LICENSE
51
52Copyright 2007 Dave Rolsky, All Rights Reserved.
53
54This program is free software; you can redistribute it and/or modify
55it under the same terms as Perl itself.
56
57=cut