use strict;
use warnings;
-use metaclass;
+use metaclass 'Moose::Meta::Class' => (
+ ':attribute_metaclass' => 'Moose::Meta::Attribute'
+);
+
+our $VERSION = '0.02';
sub new {
- my $class = shift;
- $class->meta->new_object(@_);
+ my ($class, %params) = @_;
+ my $self = $class->meta->new_object(%params);
+ $self->BUILDALL(%params);
+ return $self;
+}
+
+sub BUILDALL {
+ my ($self, %params) = @_;
+ foreach my $method ($self->meta->find_all_methods_by_name('BUILD')) {
+ $method->{code}->($self, %params);
+ }
+}
+
+sub DEMOLISHALL {
+ my $self = shift;
+ foreach my $method ($self->meta->find_all_methods_by_name('DEMOLISH')) {
+ $method->{code}->($self);
+ }
}
+sub DESTROY { goto &DEMOLISHALL }
+
1;
__END__
=head1 NAME
-Moose::Object -
+Moose::Object - The base object for Moose
-=head1 SYNOPSIS
+=head1 SYNOPSIS
=head1 DESCRIPTION
=item B<new>
+This will create a new instance and call C<BUILDALL>.
+
+=item B<BUILDALL>
+
+This will call every C<BUILD> method in the inheritance hierarchy.
+
+=item B<DEMOLISHALL>
+
+This will call every C<DEMOLISH> method in the inheritance hierarchy.
+
+=item B<NEXT>
+
=back
=head1 BUGS
exception. If you find a bug please either email me, or add the bug
to cpan-RT.
-=head1 CODE COVERAGE
-
-I use L<Devel::Cover> to test the code coverage of my tests, below is the
-L<Devel::Cover> report on this module's test suite.
-
-=head1 ACKNOWLEDGEMENTS
-
=head1 AUTHOR
Stevan Little E<lt>stevan@iinteractive.comE<gt>