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