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

NAME

6       Any::Moose - use Moose or Mouse modules
7

VERSION

9       version 0.13
10

SYNOPSIS

12   BASIC
13           package Class;
14
15           # uses Moose if it's loaded or demanded, Mouse otherwise
16           use Any::Moose;
17
18           # cleans the namespace up
19           no Any::Moose;
20
21   OTHER MODULES
22           package Other::Class;
23           use Any::Moose;
24
25           # uses Moose::Util::TypeConstraints if the class has loaded Moose,
26           # Mouse::Util::TypeConstraints otherwise.
27           use Any::Moose '::Util::TypeConstraints';
28
29   ROLES
30           package My::Sorter;
31           use Any::Moose 'Role';
32
33           requires 'cmp';
34
35   COMPLEX USAGE
36           package My::Meta::Class;
37           use Any::Moose;
38
39           # uses subtype from Moose::Util::TypeConstraints if the class loaded Moose,
40           # subtype from Mouse::Util::TypeConstraints otherwise.
41           # similarly for Mo*se::Util's does_role
42           use Any::Moose (
43               '::Util::TypeConstraints' => ['subtype'],
44               '::Util' => ['does_role'],
45           );
46
47           # uses MouseX::Types or MooseX::Types
48           use Any::Moose 'X::Types';
49
50           # gives you the right class name depending on which Mo*se was loaded
51           extends any_moose('::Meta::Class');
52

DESCRIPTION

54       Though we recommend that people generally use Moose, we accept that
55       Moose cannot yet be used for everything everywhere. People generally
56       like the Moose sugar, so many people use Mouse, a lightweight
57       replacement for parts of Moose.
58
59       Because Mouse strives for compatibility with Moose, it's easy to
60       substitute one for the other. This module facilitates that
61       substitution. By default, Mouse will be provided to libraries, unless
62       Moose is already loaded -or- explicitly requested by the end-user. The
63       end-user can force the decision of which backend to use by setting the
64       environment variable "ANY_MOOSE" to be "Moose" or "Mouse".
65
66       Note that the decision of which backend to use is made only once, so
67       that if Any-Moose picks Mouse, then a third-party library loads Moose,
68       anything else that uses Any-Moose will continue to pick Mouse.
69
70       So, if you have to use Mouse, please be considerate to the Moose
71       fanboys (like myself!) and use Any-Moose instead. ":)"
72

SEE ALSO

74       Moose
75
76       Mouse
77
78       Squirrel - a deprecated first-stab at Any-Moose-like logic. Its biggest
79       fault was in making the decision of which backend to use every time it
80       was used, rather than just once.
81

AUTHORS

83         Shawn M Moore <sartak@bestpractical.com>
84         Florian Ragwitz <rafl@debian.org>
85         Stevan Little <stevan@iinteractive.com>
86         Tokuhiro Matsuno <tokuhirom@gmail.com>
87         Goro Fuji <gfuji@cpan.org>
88
90       This software is copyright (c) 2010 by Best Practical Solutions.
91
92       This is free software; you can redistribute it and/or modify it under
93       the same terms as the Perl 5 programming language system itself.
94
95
96
97perl v5.12.1                      2010-05-19                     Any::Moose(3)
Impressum