adding meta moose
[gitmo/Moose.git] / lib / Moose / Object.pm
CommitLineData
fcd84ca9 1
2package Moose::Object;
3
4use strict;
5use warnings;
6use metaclass;
7
8sub new {
c0e30cf5 9 my $class = shift;
10 my %params = @_;
11 my $self = $class->meta->new_object(%params);
12 $self->BUILDALL(%params);
13 return $self;
fcd84ca9 14}
15
c0e30cf5 16sub BUILDALL {
17 my ($self, %params) = @_;
18 foreach my $method ($self->meta->find_all_methods_by_name('BUILD')) {
19 $method->{method}->($self, %params);
20 }
21}
22
23sub DEMOLISHALL {
24 my $self = shift;
25 foreach my $method ($self->meta->find_all_methods_by_name('DEMOLISH')) {
26 $method->{method}->($self);
27 }
28}
29
30sub DESTROY { goto &DEMOLISHALL }
31
fcd84ca9 321;
33
34__END__
35
36=pod
37
38=head1 NAME
39
40Moose::Object -
41
42=head1 SYNOPSIS
43
44=head1 DESCRIPTION
45
46=head1 METHODS
47
48=over 4
49
50=item B<meta>
51
52=item B<new>
53
c0e30cf5 54=item B<BUILDALL>
55
56=item B<DEMOLISHALL>
57
fcd84ca9 58=back
59
60=head1 BUGS
61
62All complex software has bugs lurking in it, and this module is no
63exception. If you find a bug please either email me, or add the bug
64to cpan-RT.
65
66=head1 CODE COVERAGE
67
68I use L<Devel::Cover> to test the code coverage of my tests, below is the
69L<Devel::Cover> report on this module's test suite.
70
71=head1 ACKNOWLEDGEMENTS
72
73=head1 AUTHOR
74
75Stevan Little E<lt>stevan@iinteractive.comE<gt>
76
77=head1 COPYRIGHT AND LICENSE
78
79Copyright 2006 by Infinity Interactive, Inc.
80
81L<http://www.iinteractive.com>
82
83This library is free software; you can redistribute it and/or modify
84it under the same terms as Perl itself.
85
86=cut