Commit | Line | Data |
fcd84ca9 |
1 | |
2 | package Moose::Object; |
3 | |
4 | use strict; |
5 | use warnings; |
6 | use metaclass; |
7 | |
8 | sub 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 |
16 | sub 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 | |
23 | sub DEMOLISHALL { |
24 | my $self = shift; |
25 | foreach my $method ($self->meta->find_all_methods_by_name('DEMOLISH')) { |
26 | $method->{method}->($self); |
27 | } |
28 | } |
29 | |
30 | sub DESTROY { goto &DEMOLISHALL } |
31 | |
fcd84ca9 |
32 | 1; |
33 | |
34 | __END__ |
35 | |
36 | =pod |
37 | |
38 | =head1 NAME |
39 | |
40 | Moose::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 | |
62 | All complex software has bugs lurking in it, and this module is no |
63 | exception. If you find a bug please either email me, or add the bug |
64 | to cpan-RT. |
65 | |
66 | =head1 CODE COVERAGE |
67 | |
68 | I use L<Devel::Cover> to test the code coverage of my tests, below is the |
69 | L<Devel::Cover> report on this module's test suite. |
70 | |
71 | =head1 ACKNOWLEDGEMENTS |
72 | |
73 | =head1 AUTHOR |
74 | |
75 | Stevan Little E<lt>stevan@iinteractive.comE<gt> |
76 | |
77 | =head1 COPYRIGHT AND LICENSE |
78 | |
79 | Copyright 2006 by Infinity Interactive, Inc. |
80 | |
81 | L<http://www.iinteractive.com> |
82 | |
83 | This library is free software; you can redistribute it and/or modify |
84 | it under the same terms as Perl itself. |
85 | |
86 | =cut |