1MooseX::Types::Combine(U3spemr)Contributed Perl DocumentMaotoisoenX::Types::Combine(3pm)
2
3
4

NAME

6       MooseX::Types::Combine - Combine type libraries for exporting
7

VERSION

9       version 0.50
10

SYNOPSIS

12           package CombinedTypeLib;
13
14           use base 'MooseX::Types::Combine';
15
16           __PACKAGE__->provide_types_from(qw/TypeLib1 TypeLib2/);
17
18           package UserClass;
19
20           use CombinedTypeLib qw/Type1 Type2 ... /;
21

DESCRIPTION

23       Allows you to create a single class that will allow you to export types
24       from multiple type libraries:
25
26           package TransportTypes;
27
28           use base 'MooseX::Types::Combine';
29
30           __PACKAGE__->provide_types_from(qw/ MotorizedTypes UnmotorizedTypes /);
31
32           1;
33
34       In this example all types defined in "MotorizedTypes" and
35       "UnmotorizedTypes" are available through the "TransportTypes" combined
36       type library.
37
38           package SkiingTrip;
39
40           use Moose;
41
42           use TransportTypes qw( CarType SkisType );
43
44           has car => ( is => 'ro', isa => CarType, required => 1 );
45           has ski_rack => ( is => 'ro', isa => ArrayRef[SkisType], required => 1 );
46           ...
47
48       Libraries on the right end of the list passed to "provide_types_from"
49       take precedence over those on the left in case of conflicts.  So, in
50       the above example if both the "MotorizedTypes" and "UnmotorizedTypes"
51       libraries provided a "Bike" type, you'd get the bicycle from
52       "UnmotorizedTypes" not the motorbike from "MorotizedTypes".
53
54       You can also further combine combined type libraries with additional
55       type libraries or other combined type libraries in the same way to
56       provide even larger type libraries:
57
58           package MeetingTransportTypes;
59
60           use base 'MooseX::Types::Combine';
61
62           __PACKAGE__->provide_types_from(qw/ TransportTypes TelepresenceTypes /);
63
64           1;
65

CLASS METHODS

67   provide_types_from
68       Sets or returns a list of type libraries (or combined type libraries)
69       to re-export from.
70
71   type_names
72       Returns a list of all known types by their name.
73

SEE ALSO

75       MooseX::Types
76

SUPPORT

78       Bugs may be submitted through the RT bug tracker
79       <https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Types> (or
80       bug-MooseX-Types@rt.cpan.org <mailto:bug-MooseX-Types@rt.cpan.org>).
81
82       There is also a mailing list available for users of this distribution,
83       at <http://lists.perl.org/list/moose.html>.
84
85       There is also an irc channel available for users of this distribution,
86       at "#moose" on "irc.perl.org" <irc://irc.perl.org/#moose>.
87

AUTHOR

89       Robert "phaylon" Sedlacek <rs@474.at>
90
92       This software is copyright (c) 2007 by Robert "phaylon" Sedlacek.
93
94       This is free software; you can redistribute it and/or modify it under
95       the same terms as the Perl 5 programming language system itself.
96
97
98
99perl v5.30.1                      2020-01-30       MooseX::Types::Combine(3pm)
Impressum