X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-StrictConstructor.git;a=blobdiff_plain;f=lib%2FMooseX%2FStrictConstructor%2FRole%2FObject.pm;h=f755234fa21a544b306b676dbaafecb385d0d138;hp=1f23b6ea3c3fd95552be1564bba4f8093cd448d0;hb=0639c294522cdd6d4de99e25eda6dd3290434b39;hpb=fbfaa61fd77d92711dd73a1022571b0d09166c88 diff --git a/lib/MooseX/StrictConstructor/Role/Object.pm b/lib/MooseX/StrictConstructor/Role/Object.pm index 1f23b6e..f755234 100644 --- a/lib/MooseX/StrictConstructor/Role/Object.pm +++ b/lib/MooseX/StrictConstructor/Role/Object.pm @@ -5,24 +5,21 @@ use warnings; use Moose::Role; - -after 'BUILDALL' => sub -{ +after 'BUILDALL' => sub { my $self = shift; my $params = shift; - my %attrs = - ( map { $_ => 1 } - grep { defined } - map { $_->init_arg() } - $self->meta()->compute_all_applicable_attributes() - ); + my %attrs = ( + map { $_ => 1 } + grep {defined} + map { $_->init_arg() } $self->meta()->get_all_attributes() + ); - my @bad = sort grep { ! $attrs{$_} } keys %{ $params }; + my @bad = sort grep { !$attrs{$_} } keys %{$params}; - if (@bad) - { - confess "Found unknown attribute(s) init_arg passed to the constructor: @bad"; + if (@bad) { + confess + "Found unknown attribute(s) init_arg passed to the constructor: @bad"; } return; @@ -32,13 +29,19 @@ no Moose::Role; 1; +# ABSTRACT: A role which implements a strict constructor for Moose::Object + __END__ =pod -=head1 NAME +=head1 SYNOPSIS -MooseX::StrictConstructor::Role::Object - A role which implements a stricto constructor for Moose::Object + Moose::Util::MetaRole::apply_base_class_roles + ( for_class => $caller, + roles => + [ 'MooseX::StrictConstructor::Role::Object' ], + ); =head1 DESCRIPTION @@ -47,15 +50,4 @@ role applied to them. It provides a method modifier for C from C that implements strict argument checking for your class. -=head1 AUTHOR - -Dave Rolsky, C<< >> - -=head1 COPYRIGHT & LICENSE - -Copyright 2007-2008 Dave Rolsky, All Rights Reserved. - -This program is free software; you can redistribute it and/or modify -it under the same terms as Perl itself. - =cut