Commit | Line | Data |
6e57504d |
1 | |
2 | package Class::MOP::Object; |
3 | |
4 | use strict; |
5 | use warnings; |
6 | |
7 | use Scalar::Util 'blessed'; |
8 | |
074ec38f |
9 | our $VERSION = '0.89'; |
d519662a |
10 | $VERSION = eval $VERSION; |
6e57504d |
11 | our $AUTHORITY = 'cpan:STEVAN'; |
12 | |
13 | # introspection |
14 | |
15 | sub meta { |
16 | require Class::MOP::Class; |
17 | Class::MOP::Class->initialize(blessed($_[0]) || $_[0]); |
18 | } |
19 | |
4e99d48b |
20 | sub _new { |
6d49ce62 |
21 | Class::MOP::class_of(shift)->new_object(@_); |
4e99d48b |
22 | } |
23 | |
c4260b45 |
24 | # RANT: |
25 | # Cmon, how many times have you written |
26 | # the following code while debugging: |
27 | # |
28 | # use Data::Dumper; |
29 | # warn Dumper $obj; |
30 | # |
31 | # It can get seriously annoying, so why |
32 | # not just do this ... |
33 | sub dump { |
34 | my $self = shift; |
35 | require Data::Dumper; |
acce7fd6 |
36 | local $Data::Dumper::Maxdepth = shift || 1; |
c4260b45 |
37 | Data::Dumper::Dumper $self; |
38 | } |
39 | |
6e57504d |
40 | 1; |
41 | |
42 | __END__ |
43 | |
44 | =pod |
45 | |
46 | =head1 NAME |
47 | |
d6c497d5 |
48 | Class::MOP::Object - Base class for metaclasses |
6e57504d |
49 | |
50 | =head1 DESCRIPTION |
51 | |
d6c497d5 |
52 | This class is a very minimal base class for metaclasses. |
53 | |
6e57504d |
54 | =head1 METHODS |
55 | |
d6c497d5 |
56 | This class provides a few methods which are useful in all metaclasses. |
57 | |
6e57504d |
58 | =over 4 |
59 | |
d6c497d5 |
60 | =item B<< Class::MOP::???->meta >> |
61 | |
62 | This returns a L<Class::MOP::Class> object. |
6e57504d |
63 | |
d6c497d5 |
64 | =item B<< $metaobject->dump($max_depth) >> |
c4260b45 |
65 | |
d6c497d5 |
66 | This method uses L<Data::Dumper> to dump the object. You can pass an |
67 | optional maximum depth, which will set C<$Data::Dumper::Maxdepth>. The |
68 | default maximum depth is 1. |
88dd563c |
69 | |
6e57504d |
70 | =back |
71 | |
72 | =head1 AUTHORS |
73 | |
74 | Stevan Little E<lt>stevan@iinteractive.comE<gt> |
75 | |
76 | =head1 COPYRIGHT AND LICENSE |
77 | |
070bb6c9 |
78 | Copyright 2006-2009 by Infinity Interactive, Inc. |
6e57504d |
79 | |
80 | L<http://www.iinteractive.com> |
81 | |
82 | This library is free software; you can redistribute it and/or modify |
83 | it under the same terms as Perl itself. |
84 | |
88dd563c |
85 | =cut |