6 use metaclass 'Moose::Meta::Class' => (
7 ':attribute_metaclass' => 'Moose::Meta::Attribute'
10 our $VERSION = '0.02';
13 my ($class, %params) = @_;
14 my $self = $class->meta->new_object(%params);
15 $self->BUILDALL(\%params);
20 my ($self, $params) = @_;
21 foreach my $method (reverse $self->meta->find_all_methods_by_name('BUILD')) {
22 $method->{code}->($self, $params);
28 foreach my $method ($self->meta->find_all_methods_by_name('DEMOLISH')) {
29 $method->{code}->($self);
33 sub DESTROY { goto &DEMOLISHALL }
43 Moose::Object - The base object for Moose
47 This serves as the base object for all Moose classes. Every
48 effort will be made to ensure that all classes which C<use Moose>
49 will inherit from this class. It provides a default constructor
50 and destructor, which run all the BUILD and DEMOLISH methods in
53 You don't actually I<need> to inherit from this in order to
54 use Moose though. It is just here to make life easier.
62 This will return the metaclass associated with the given class.
66 This will create a new instance and call C<BUILDALL>.
70 This will call every C<BUILD> method in the inheritance hierarchy,
71 and pass it a hash-ref of the the C<%params> passed to C<new>.
75 This will call every C<DEMOLISH> method in the inheritance hierarchy.
81 All complex software has bugs lurking in it, and this module is no
82 exception. If you find a bug please either email me, or add the bug
87 Stevan Little E<lt>stevan@iinteractive.comE<gt>
89 =head1 COPYRIGHT AND LICENSE
91 Copyright 2006 by Infinity Interactive, Inc.
93 L<http://www.iinteractive.com>
95 This library is free software; you can redistribute it and/or modify
96 it under the same terms as Perl itself.