Commit | Line | Data |
6e57504d |
1 | |
2 | package Class::MOP::Object; |
3 | |
4 | use strict; |
5 | use warnings; |
6 | |
7 | use Scalar::Util 'blessed'; |
8 | |
b4bd10ec |
9 | our $VERSION = '0.77'; |
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 { |
21 | shift->meta->new_object(@_); |
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 | |
48 | Class::MOP::Object - Object Meta Object |
49 | |
50 | =head1 DESCRIPTION |
51 | |
121991f6 |
52 | This class is basically a stub, it provides almost no functionality at all, |
6e57504d |
53 | and really just exists to make the Class::MOP metamodel complete. |
54 | |
55 | ...... |
56 | : : |
57 | : v |
58 | +-------------------+ |
59 | +-----| Class::MOP::Class | |
60 | | +-------------------+ |
61 | | ^ ^ ^ |
62 | v : : : |
63 | +--------------------+ : +--------------------+ |
64 | | Class::MOP::Module | : | Class::MOP::Object | |
65 | +--------------------+ : +--------------------+ |
66 | | : ^ |
67 | | : | |
68 | | +---------------------+ | |
69 | +--->| Class::MOP::Package |-----+ |
70 | +---------------------+ |
71 | |
72 | legend: |
73 | ..(is an instance of)..> |
88dd563c |
74 | --(is a subclass of)---> |
6e57504d |
75 | |
76 | A deeper discussion of this model is currently beyond the scope of |
77 | this documenation. |
78 | |
79 | =head1 METHODS |
80 | |
81 | =over 4 |
82 | |
83 | =item B<meta> |
84 | |
c4260b45 |
85 | =item B<dump (?$max_depth)> |
86 | |
88dd563c |
87 | This will C<require> the L<Data::Dumper> module and then dump a |
88 | representation of your object. It passed the C<$max_depth> arg |
89 | to C<$Data::Dumper::Maxdepth>. The default C<$max_depth> is 1, |
90 | so it will not go crazy and print a massive bunch of stuff. |
91 | Adjust this as nessecary. |
92 | |
6e57504d |
93 | =back |
94 | |
95 | =head1 AUTHORS |
96 | |
97 | Stevan Little E<lt>stevan@iinteractive.comE<gt> |
98 | |
99 | =head1 COPYRIGHT AND LICENSE |
100 | |
69e3ab0a |
101 | Copyright 2006-2008 by Infinity Interactive, Inc. |
6e57504d |
102 | |
103 | L<http://www.iinteractive.com> |
104 | |
105 | This library is free software; you can redistribute it and/or modify |
106 | it under the same terms as Perl itself. |
107 | |
88dd563c |
108 | =cut |