Update Changes, bump version to 0.97_01, make copyright 2006-2010
[gitmo/Class-MOP.git] / lib / Class / MOP / Object.pm
1
2 package Class::MOP::Object;
3
4 use strict;
5 use warnings;
6
7 use Scalar::Util 'blessed';
8
9 our $VERSION   = '0.97_01';
10 $VERSION = eval $VERSION;
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
20 sub _new {
21     Class::MOP::class_of(shift)->new_object(@_);
22 }
23
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;
36     local $Data::Dumper::Maxdepth = shift || 1;
37     Data::Dumper::Dumper $self;
38 }
39
40 1;
41
42 __END__
43
44 =pod
45
46 =head1 NAME 
47
48 Class::MOP::Object - Base class for metaclasses
49
50 =head1 DESCRIPTION
51
52 This class is a very minimal base class for metaclasses.
53
54 =head1 METHODS
55
56 This class provides a few methods which are useful in all metaclasses.
57
58 =over 4
59
60 =item B<< Class::MOP::???->meta >>
61
62 This returns a L<Class::MOP::Class> object.
63
64 =item B<< $metaobject->dump($max_depth) >>
65
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.
69
70 =back
71
72 =head1 AUTHORS
73
74 Stevan Little E<lt>stevan@iinteractive.comE<gt>
75
76 =head1 COPYRIGHT AND LICENSE
77
78 Copyright 2006-2010 by Infinity Interactive, Inc.
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
85 =cut