1MooseX::Extended::Role:U:sCeurstCoomn(t3r)ibuted Perl DoMcouomseenXt:a:tEixotnended::Role::Custom(3)
2
3
4

NAME

6       MooseX::Extended::Role::Custom - Build a custom Moose::Role, just for
7       you.
8

VERSION

10       version 0.35
11

SYNOPSIS

13       Define your own version of MooseX::Extended:
14
15           package My::Moose::Role {
16               use MooseX::Extended::Role::Custom;
17
18               sub import {
19                   my ( $class, %args ) = @_;
20                   MooseX::Extended::Role::Custom->create(
21                       excludes => [qw/ carp /],
22                       includes => ['multi'],
23                       %args    # you need this to allow customization of your customization
24                   );
25               }
26           }
27
28           # no need for a true value
29
30       And then use it:
31
32           package Some::Class::Role {
33               use My::Moose::Role types => [qw/ArrayRef Num/];
34
35               param numbers => ( isa => ArrayRef[Num] );
36
37               multi sub foo ($self)       { ... }
38               multi sub foo ($self, $bar) { ... }
39           }
40

DESCRIPTION

42       I hate boilerplate, so let's get rid of it. Let's say you don't want
43       warnings on classes implicitly overriding role methods,
44       namespace::autoclean or "carp", but you do want "multi". Plus, you have
45       custom versions of "carp" and "croak":
46
47           package Some::Class {
48               use MooseX::Extended
49                 excludes => [qw/ WarnOnConflict autoclean carp /],
50                 includes => ['multi'];
51               use My::Carp q(carp croak);
52
53               ... my code here
54           }
55
56       You probably get tired of typing that every time. Now you don't have
57       to.
58
59           package My::Moose {
60               use MooseX::Extended::Custom;
61               use My::Carp ();
62               use Import::Into;
63
64               sub import {
65                   my ( $class, %args ) = @_;
66                   my $target_class = caller;
67                   MooseX::Extended::Custom->create(
68                       excludes => [qw/ autoclean carp /],
69                       includes => ['multi'],
70                       %args    # you need this to allow customization of your customization
71                   );
72                   My::Carp->import::into($target_class, qw(carp croak));
73               }
74           }
75
76       And then when you use "My::Moose", that's all set up for you.
77
78       If you need to change this on a "per class" basis:
79
80           use My::Moose
81             excludes => ['carp'],
82             types    => [qw/ArrayRef Num/];
83
84       The above changes your "excludes" and adds "types", but doesn't change
85       your "includes".
86

AUTHOR

88       Curtis "Ovid" Poe <curtis.poe@gmail.com>
89
91       This software is Copyright (c) 2022 by Curtis "Ovid" Poe.
92
93       This is free software, licensed under:
94
95         The Artistic License 2.0 (GPL Compatible)
96
97
98
99perl v5.38.0                      2023-06-26 MooseX::Extended::Role::Custom(3)
Impressum