---
name: "MooseX::Types::Combine"
section: "3pm"
platform: "linux"
package: "libmoosex-types-perl"
version: "0.51-4"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/MooseX::Types::Combine"
---

# MooseX::Types::Combine(3pm)

Combine type libraries for exporting

## NAME

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

## VERSION

version 0.51

## SYNOPSIS

```
    package CombinedTypeLib;
    use base 'MooseX::Types::Combine';
    __PACKAGE__->provide_types_from(qw/TypeLib1 TypeLib2/);
    package UserClass;
    use CombinedTypeLib qw/Type1 Type2 ... /;
```

## DESCRIPTION

Allows you to create a single class that will allow you to export types from multiple type libraries:

```
    package TransportTypes;
    use base 'MooseX::Types::Combine';
    __PACKAGE__->provide_types_from(qw/ MotorizedTypes UnmotorizedTypes /);
    1;
```

In this example all types defined in `"MotorizedTypes"` and `"UnmotorizedTypes"` are available through the `"TransportTypes"` combined type library.

```
    package SkiingTrip;
    use Moose;
    use TransportTypes qw( CarType SkisType );
    has car => ( is => 'ro', isa => CarType, required => 1 );
    has ski_rack => ( is => 'ro', isa => ArrayRef[SkisType], required => 1 );
    ...
```

Libraries on the right end of the list passed to "provide\_types\_from" take precedence over those on the left in case of conflicts.  So, in the above example if both the `"MotorizedTypes"` and `"UnmotorizedTypes"` libraries provided a `"Bike"` type, you'd get the bicycle from `"UnmotorizedTypes"` not the motorbike from `"MorotizedTypes"`.

You can also further combine combined type libraries with additional type libraries or other combined type libraries in the same way to provide even larger type libraries:

```
    package MeetingTransportTypes;
    use base 'MooseX::Types::Combine';
    __PACKAGE__->provide_types_from(qw/ TransportTypes TelepresenceTypes /);
    1;
```

## CLASS METHODS

### provide\_types\_from

Sets or returns a list of type libraries (or combined type libraries) to re-export from.

### type\_names

Returns a list of all known types by their name.

## SEE ALSO

MooseX::Types

## SUPPORT

Bugs may be submitted through the RT bug tracker \<https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Types\> (or bug-MooseX-Types@rt.cpan.org \<mailto:bug-MooseX-Types@rt.cpan.org\>).

There is also a mailing list available for users of this distribution, at \<http://lists.perl.org/list/moose.html\>.

There is also an irc channel available for users of this distribution, at `"#moose"` on `"irc.perl.org"` \<irc://irc.perl.org/#moose\>.

## AUTHOR

Robert "phaylon" Sedlacek \<rs@474.at\>

## COPYRIGHT AND LICENCE

This software is copyright (c) 2007 by Robert "phaylon" Sedlacek.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
