6 use metaclass 'Moose::Meta::Class' => (
7 ':attribute_metaclass' => 'Moose::Meta::Attribute'
10 our $VERSION = '0.04';
14 my %params = (scalar @_ == 1) ? %{$_[0]} : @_;
15 my $self = $class->meta->new_object(%params);
16 $self->BUILDALL(\%params);
21 my ($self, $params) = @_;
22 foreach my $method (reverse $self->meta->find_all_methods_by_name('BUILD')) {
23 $method->{code}->($self, $params);
29 foreach my $method ($self->meta->find_all_methods_by_name('DEMOLISH')) {
30 $method->{code}->($self);
34 sub DESTROY { goto &DEMOLISHALL }
36 # new does() methods will be created
37 # as approiate see Moose::Meta::Role
48 Moose::Object - The base object for Moose
52 This serves as the base object for all Moose classes. Every
53 effort will be made to ensure that all classes which C<use Moose>
54 will inherit from this class. It provides a default constructor
55 and destructor, which run all the BUILD and DEMOLISH methods in
58 You don't actually I<need> to inherit from this in order to
59 use Moose though. It is just here to make life easier.
67 This will return the metaclass associated with the given class.
71 This will create a new instance and call C<BUILDALL>.
75 This will call every C<BUILD> method in the inheritance hierarchy,
76 and pass it a hash-ref of the the C<%params> passed to C<new>.
80 This will call every C<DEMOLISH> method in the inheritance hierarchy.
82 =item B<does ($role_name)>
88 All complex software has bugs lurking in it, and this module is no
89 exception. If you find a bug please either email me, or add the bug
94 Stevan Little E<lt>stevan@iinteractive.comE<gt>
96 =head1 COPYRIGHT AND LICENSE
98 Copyright 2006 by Infinity Interactive, Inc.
100 L<http://www.iinteractive.com>
102 This library is free software; you can redistribute it and/or modify
103 it under the same terms as Perl itself.