From: Dave Rolsky Date: Mon, 17 Dec 2007 20:31:08 +0000 (+0000) Subject: Make the meta classes more Moose-y. X-Git-Tag: 0.04~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=583707172fbd74d82c2c079f430555b7a6275237;p=gitmo%2FMooseX-StrictConstructor.git Make the meta classes more Moose-y. Add POD for all classes. --- diff --git a/lib/MooseX/StrictConstructor/Meta/Class.pm b/lib/MooseX/StrictConstructor/Meta/Class.pm index d420465..78a639d 100644 --- a/lib/MooseX/StrictConstructor/Meta/Class.pm +++ b/lib/MooseX/StrictConstructor/Meta/Class.pm @@ -3,20 +3,58 @@ package MooseX::StrictConstructor::Meta::Class; use strict; use warnings; -use base 'Moose::Meta::Class'; - use MooseX::StrictConstructor::Meta::Method::Constructor; +use Moose; + +extends 'Moose::Meta::Class'; -sub make_immutable { ## no critic RequireArgUnpacking +override 'make_immutable' => sub ## no critic RequireArgUnpacking +{ my $self = shift; return $self->SUPER::make_immutable ( constructor_class => 'MooseX::StrictConstructor::Meta::Method::Constructor', - @_ + @_, ); -} +}; + +no Moose; 1; + +__END__ + +=pod + +=head1 NAME + +MooseX::StrictConstructor::Meta::Class - A meta class for classes with strict constructors + +=head1 SYNOPSIS + + use MooseX::StrictConstructor; + +=head1 DESCRIPTION + +This class simply overrides C in +C to use +C as the +constructor class. + +You should never have to use this class directly. + +=head1 AUTHOR + +Dave Rolsky, C<< >> + +=head1 COPYRIGHT & LICENSE + +Copyright 2007 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 diff --git a/lib/MooseX/StrictConstructor/Meta/Method/Constructor.pm b/lib/MooseX/StrictConstructor/Meta/Method/Constructor.pm index f72fa66..45b1fd8 100644 --- a/lib/MooseX/StrictConstructor/Meta/Method/Constructor.pm +++ b/lib/MooseX/StrictConstructor/Meta/Method/Constructor.pm @@ -8,8 +8,7 @@ use Moose; extends 'Moose::Meta::Method::Constructor'; -# using -sub _generate_BUILDALL ## no critic RequireArgUnpacking +override '_generate_BUILDALL' => sub ## no critic RequireArgUnpacking { my $self = shift; @@ -31,5 +30,41 @@ EOF return $source; }; +no Moose; + 1; + +__END__ + +=pod + +=head1 NAME + +MooseX::StrictConstructor::Meta::Method::Constructor - A meta class to make immutable constructors strict + +=head1 SYNOPSIS + + use MooseX::StrictConstructor; + +=head1 DESCRIPTION + +This class simply overrides C<_generate_BUILDALL()> in +C so that classes that are made +immutable have a strict constructor. + +You should never have to use this class directly. + +=head1 AUTHOR + +Dave Rolsky, C<< >> + +=head1 COPYRIGHT & LICENSE + +Copyright 2007 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 +