MooseX...ombine(3pm)

πŸ’… NAME πŸ’…

okay so welcome to MooseX...ombine(3pm) from the User Contributed Perl Documentation corner of the universe ✨. This page is about MooseX::Types::Combine: combine type libraries for exporting. Yes bestie, it's the group-chat admin that lets one combined type library export types from a whole squad of other type libraries. πŸ’–

✨ VERSION ✨

version 0.51 β€” that's the number, no cap. πŸŽ€

πŸŽ€ SYNOPSIS πŸŽ€

package CombinedTypeLib;

use base 'MooseX::Types::Combine';

__PACKAGE__->provide_types_from(qw/TypeLib1 TypeLib2/);

package UserClass;

use CombinedTypeLib qw/Type1 Type2 ... /;

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so MooseX::Types::Combine lets you create a single class that will allow you to export types from multiple type libraries. literally the whole point. Behold:

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. slay. πŸ’…

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. (yes, MorotizedTypes β€” that's the spelling on the page, we keep it exactly, bestie 🫢)

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. That's it. It's giving β€œlist manager with main character energy.” ✨

πŸ’œ type_names πŸ’œ

Returns a list of all known types by their name. name check complete πŸ’…

🌈 SEE ALSO 🌈

  • MooseX::Types β€” the og bestie, go read that too. πŸ’–

⭐ 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> β€” iconic. πŸ’…

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.


mwah πŸ’‹ β€” that's the whole page, bestie. signed off with perl v5.42.0 on 2025-07-25. now go combine those types and slay. πŸŒˆπŸ‘‘

πŸ“¦ where this page comes from