1MooseX::Util(3) User Contributed Perl Documentation MooseX::Util(3)
2
3
4
6 MooseX::Util - Moose::Util extensions
7
9 This document describes version 0.006 of MooseX::Util - released June
10 26, 2015 as part of MooseX-Util.
11
13 use MooseX::Util qw{ ensure_all_roles with_traits };
14
15 # profit!
16
18 This is a utility module that handles all of the same functions that
19 Moose::Util handles. In fact, most of the functions exported by this
20 package are simply re-exports from Moose::Util, so you're recommended
21 to read the documentation of that module for a comprehensive view.
22
23 However.
24
25 We've re-implemented a number of the functions our parent provides, for
26 a variety of reasons. Those functions are documented here.
27
29 with_traits(<classname> => (<trait1>, ... ))
30 Given a class and one or more traits, we construct an anonymous class
31 that is a subclass of the given class and consumes the traits given.
32 This is exactly the same as "with_traits" in Moose::Util, except that
33 we use "create_anon_class" in MooseX::Util::Meta::Class to construct
34 the anonymous class, rather than "create_anon_class" in
35 Moose::Meta::Class directly.
36
37 Essentially, this means that when we do:
38
39 my $anon_class_name = with_traits('Zombie::Catcher', 'SomeTrait');
40
41 For $anon_class_name we get:
42
43 Zombie::Catcher::__ANON__::SERIAL::1
44
45 Rather than:
46
47 Moose::Meta::Class::__ANON__::SERIAL::1
48
49 This is nice because we have an idea of where the first anonymous class
50 came from, whereas the second one could could be from anywhere.
51
52 is_private
53 # true if "private"
54 ... if is_private('_some_name');
55
56 Ofttimes we need to determine if a name is considered "private" or not.
57 By convention, method, attribute, and other names are considered
58 private if their first character is an underscore.
59
60 While trivial to test for, this allows us to centralize the tests in
61 one place.
62
64 Please see those modules/websites for more information related to this
65 module.
66
67 ยท Moose::Util
68
70 Please report any bugs or feature requests on the bugtracker website
71 https://github.com/RsrchBoy/moosex-util/issues
72
73 When submitting a bug or request, please include a test-file or a patch
74 to an existing test-file that illustrates the bug or desired feature.
75
77 Chris Weyl <cweyl@alumni.drew.edu>
78
79 I'm a material boy in a material world
80 Please note I do not expect to be gittip'ed or flattr'ed for this work,
81 rather it is simply a very pleasant surprise. I largely create and
82 release works like this because I need them or I find it enjoyable;
83 however, don't let that stop you if you feel like it ;)
84
85 Flattr
86 <https://flattr.com/submit/auto?user_id=RsrchBoy&url=https%3A%2F%2Fgithub.com%2FRsrchBoy%2Fmoosex-
87 util&title=RsrchBoy's%20CPAN%20MooseX-Util&tags=%22RsrchBoy's%20MooseX-
88 Util%20in%20the%20CPAN%22>, Gratipay <https://gratipay.com/RsrchBoy/>,
89 or indulge my Amazon Wishlist <http://bit.ly/rsrchboys-wishlist>... If
90 and *only* if you so desire.
91
93 This software is Copyright (c) 2012 by Chris Weyl.
94
95 This is free software, licensed under:
96
97 The GNU Lesser General Public License, Version 2.1, February 1999
98
99
100
101perl v5.28.1 2015-06-26 MooseX::Util(3)