2 use lib '/Users/stevan/CPAN/Class-MOP/Class-MOP/lib';
11 use Scalar::Util 'blessed';
13 use Sub::Name 'subname';
15 use Moose::Meta::Class;
16 use Moose::Meta::Attribute;
25 if ($pkg->can('meta')) {
27 (blessed($meta) && $meta->isa('Class::MOP::Class'))
28 || confess "Whoops, not møøsey enough";
31 $meta = Moose::Meta::Class->initialize($pkg => (
32 ':attribute_metaclass' => 'Moose::Meta::Attribute'
37 # &alias_method will install the method, but it
38 # will not name it with
41 $meta->alias_method('extends' => subname 'Moose::extends' => sub { $meta->superclasses(@_) });
44 $meta->alias_method('has' => subname 'Moose::has' => sub { $meta->add_attribute(@_) });
46 # handle method modifers
47 $meta->alias_method('before' => subname 'Moose::before' => sub {
49 $meta->add_before_method_modifier($_, $code) for @_;
51 $meta->alias_method('after' => subname 'Moose::after' => sub {
53 $meta->add_after_method_modifier($_, $code) for @_;
55 $meta->alias_method('around' => subname 'Moose::around' => sub {
57 $meta->add_around_method_modifier($_, $code) for @_;
60 # make sure they inherit from Moose::Object
61 $meta->superclasses('Moose::Object')
62 unless $meta->superclasses();
64 # we recommend using these things
65 # so export them for them
66 $meta->alias_method('confess' => \&confess);
67 $meta->alias_method('blessed' => \&blessed);
87 has '$.x' => (reader => 'x');
88 has '$.y' => (accessor => 'y');
105 after 'clear' => sub {
114 Makes Other Object Systems Envious
116 Most Other Objects Suck Eggs
118 Makes Object Orientation So Easy
120 Metacircular Object Oriented Systems Environment
124 All complex software has bugs lurking in it, and this module is no
125 exception. If you find a bug please either email me, or add the bug
130 I use L<Devel::Cover> to test the code coverage of my tests, below is the
131 L<Devel::Cover> report on this module's test suite.
133 =head1 ACKNOWLEDGEMENTS
137 Stevan Little E<lt>stevan@iinteractive.comE<gt>
139 =head1 COPYRIGHT AND LICENSE
141 Copyright 2006 by Infinity Interactive, Inc.
143 L<http://www.iinteractive.com>
145 This library is free software; you can redistribute it and/or modify
146 it under the same terms as Perl itself.