Commit | Line | Data |
6e57504d |
1 | |
2 | package Class::MOP::Object; |
3 | |
4 | use strict; |
5 | use warnings; |
6 | |
7 | use Scalar::Util 'blessed'; |
8 | |
c4260b45 |
9 | our $VERSION = '0.02'; |
6e57504d |
10 | our $AUTHORITY = 'cpan:STEVAN'; |
11 | |
12 | # introspection |
13 | |
14 | sub meta { |
15 | require Class::MOP::Class; |
16 | Class::MOP::Class->initialize(blessed($_[0]) || $_[0]); |
17 | } |
18 | |
c4260b45 |
19 | # RANT: |
20 | # Cmon, how many times have you written |
21 | # the following code while debugging: |
22 | # |
23 | # use Data::Dumper; |
24 | # warn Dumper $obj; |
25 | # |
26 | # It can get seriously annoying, so why |
27 | # not just do this ... |
28 | sub dump { |
29 | my $self = shift; |
30 | require Data::Dumper; |
31 | $Data::Dumper::Maxdepth = shift || 1; |
32 | Data::Dumper::Dumper $self; |
33 | } |
34 | |
6e57504d |
35 | 1; |
36 | |
37 | __END__ |
38 | |
39 | =pod |
40 | |
41 | =head1 NAME |
42 | |
43 | Class::MOP::Object - Object Meta Object |
44 | |
45 | =head1 DESCRIPTION |
46 | |
47 | This class is basically a stub, it provides no functionality at all, |
48 | and really just exists to make the Class::MOP metamodel complete. |
49 | |
50 | ...... |
51 | : : |
52 | : v |
53 | +-------------------+ |
54 | +-----| Class::MOP::Class | |
55 | | +-------------------+ |
56 | | ^ ^ ^ |
57 | v : : : |
58 | +--------------------+ : +--------------------+ |
59 | | Class::MOP::Module | : | Class::MOP::Object | |
60 | +--------------------+ : +--------------------+ |
61 | | : ^ |
62 | | : | |
63 | | +---------------------+ | |
64 | +--->| Class::MOP::Package |-----+ |
65 | +---------------------+ |
66 | |
67 | legend: |
68 | ..(is an instance of)..> |
88dd563c |
69 | --(is a subclass of)---> |
6e57504d |
70 | |
71 | A deeper discussion of this model is currently beyond the scope of |
72 | this documenation. |
73 | |
74 | =head1 METHODS |
75 | |
76 | =over 4 |
77 | |
78 | =item B<meta> |
79 | |
c4260b45 |
80 | =item B<dump (?$max_depth)> |
81 | |
88dd563c |
82 | This will C<require> the L<Data::Dumper> module and then dump a |
83 | representation of your object. It passed the C<$max_depth> arg |
84 | to C<$Data::Dumper::Maxdepth>. The default C<$max_depth> is 1, |
85 | so it will not go crazy and print a massive bunch of stuff. |
86 | Adjust this as nessecary. |
87 | |
6e57504d |
88 | =back |
89 | |
90 | =head1 AUTHORS |
91 | |
92 | Stevan Little E<lt>stevan@iinteractive.comE<gt> |
93 | |
94 | =head1 COPYRIGHT AND LICENSE |
95 | |
96 | Copyright 2006 by Infinity Interactive, Inc. |
97 | |
98 | L<http://www.iinteractive.com> |
99 | |
100 | This library is free software; you can redistribute it and/or modify |
101 | it under the same terms as Perl itself. |
102 | |
88dd563c |
103 | =cut |