1Moose::Util(3)        User Contributed Perl Documentation       Moose::Util(3)
2
3
4

NAME

6       Moose::Util - Utilities for working with Moose classes
7

SYNOPSIS

9         use Moose::Util qw/find_meta does_role search_class_by_role/;
10
11         my $meta = find_meta($object) ⎪⎪ die "No metaclass found";
12
13         if (does_role($object, $role)) {
14           print "The object can do $role!\n";
15         }
16
17         my $class = search_class_by_role($object, 'FooRole');
18         print "Nearest class with 'FooRole' is $class\n";
19

DESCRIPTION

21       This is a set of utility functions to help working with Moose classes.
22       This is an experimental module, and it's not 100% clear what purpose it
23       will serve.  That said, ideas, suggestions and contributions to this
24       collection are most welcome. See the TODO section below for a list of
25       ideas for possible functions to write.
26

EXPORTED FUNCTIONS

28       find_meta ($class_or_obj)
29           This will attempt to locate a metaclass for the given $class_or_obj
30           and return it.
31
32       does_role ($class_or_obj, $role_name)
33           Returns true if $class_or_obj can do the role $role_name.
34
35       search_class_by_role ($class_or_obj, $role_name)
36           Returns first class in precedence list that consumed $role_name.
37

TODO

39       Here is a list of possible functions to write
40
41       discovering original method from modified method
42       search for origin class of a method or attribute
43

BUGS

45       All complex software has bugs lurking in it, and this module is no
46       exception. If you find a bug please either email me, or add the bug to
47       cpan-RT.
48

AUTHOR

50       Anders Nor Berle <debolaz@gmail.com>
51
52       with contributions from:
53
54       Robert (phaylon) Sedlacek
55
56       Stevan Little
57
59       Copyright 2007 by Infinity Interactive, Inc.
60
61       <http://www.iinteractive.com>
62
63       This library is free software; you can redistribute it and/or modify it
64       under the same terms as Perl itself.
65
66
67
68perl v5.8.8                       2007-09-06                    Moose::Util(3)
Impressum