8 use Scalar::Util 'blessed';
9 use Sub::Name 'subname';
11 our $VERSION = '0.01';
13 use Moose::Meta::Role;
14 use Moose::Util::TypeConstraints;
20 # we should never export to main
21 return if $pkg eq 'main';
23 Moose::Util::TypeConstraints->import($pkg);
26 if ($pkg->can('meta')) {
28 (blessed($meta) && $meta->isa('Moose::Meta::Role'))
29 || confess "Whoops, not møøsey enough";
32 $meta = Moose::Meta::Role->initialize(':package' => $pkg);
33 $meta->add_method('meta' => sub {
34 # re-initialize so it inherits properly
35 Moose::Meta::Role->initialize(':package' => $pkg);
40 # &alias_method will install the method, but it
41 # will not name it with
42 $meta->alias_method('requires' => subname 'Moose::Role::requires' => sub {
43 push @{$meta->requires} => @_;
47 # make sure they inherit from Moose::Role::Base
50 @{$meta->name . '::ISA'} = ('Moose::Role::Base');
53 # we recommend using these things
54 # so export them for them
55 $meta->alias_method('confess' => \&Carp::confess);
56 $meta->alias_method('blessed' => \&Scalar::Util::blessed);
59 package Moose::Role::Base;
64 our $VERSION = '0.01';
74 Moose::Role - The Moose role
88 All complex software has bugs lurking in it, and this module is no
89 exception. If you find a bug please either email me, or add the bug
94 Stevan Little E<lt>stevan@iinteractive.comE<gt>
96 =head1 COPYRIGHT AND LICENSE
98 Copyright 2006 by Infinity Interactive, Inc.
100 L<http://www.iinteractive.com>
102 This library is free software; you can redistribute it and/or modify
103 it under the same terms as Perl itself.