Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

moosex::types::varianttable::declare(3pm) [debian man page]

MooseX::Types::VariantTable::Declare(3pm)		User Contributed Perl Documentation		 MooseX::Types::VariantTable::Declare(3pm)

NAME
MooseX::Types::VariantTable::Declare - Declarative sugar for MooseX::Types::VariantTable based methods. SYNOPSIS
package Awesome; use Moose; variant_method dance => Item => sub { # Item is the least derived type in the hierarchy, # every other type subtypes it # this is in effect a fallback return "fallback"; }; # a more specific type variant_method dance => Ballerina => sub { my ( $self, $ballerina, @args ) = @_; $ballerina; # a value that passed the TC named "Ballerina" return "pretty!"; }; # also works with objects variant_method dance => $type_object => sub { ... }; DESCRIPTION
This module provides declarative sugar for defining Moose::Meta::Method::VariantTable methods in your Moose classes and roles. These methods have some semantics: Declaration The order of the declarations do not matter in most cases. It is the type hierarchy that defines the order in which the constraints are checked and items dispatched. However, in the case that two constraints without an explicit relationship between them (one is a subtype of the other) both accept the same value, the one that was declared earlier will win. There is no way around this issue, so be careful what types you use especially when mixing variants form many different sources. Adding the same type to a variant table twice is an error. Inheritence When dispatching all of the subclass's variants will be tried before the superclass. This allows shadowing of types from the superclass even using broader types. Roles ... are currently broken. Don't use variant table methods in a role, unless that's the only definition, because in the future variant table merging will happen at role composition time in a role composition like way, so your code will not continue to work the same. perl v5.10.1 2011-02-27 MooseX::Types::VariantTable::Declare(3pm)

Check Out this Related Man Page

MooseX::Types::Moose(3pm)				User Contributed Perl Documentation				 MooseX::Types::Moose(3pm)

NAME
MooseX::Types::Moose - Type exports that match the types shipped with Moose VERSION
version 0.41 SYNOPSIS
package Foo; use Moose; use MooseX::Types::Moose qw( ArrayRef Int Str ); use Carp qw( croak ); has 'name', is => 'rw', isa => Str; has 'ids', is => 'rw', isa => ArrayRef[Int]; sub add { my ($self, $x, $y) = @_; croak 'First arg not an Int' unless is_Int($x); croak 'Second arg not an Int' unless is_Int($y); return $x + $y; } 1; DESCRIPTION
This package contains a virtual library for MooseX::Types that is able to export all types known to Moose. See MooseX::Types for general usage information. METHODS
type_storage Overrides MooseX::Types::Base' "type_storage" to provide a hash reference containing all built-in Moose types. SEE ALSO
MooseX::Types::Moose, Moose, Moose::Util::TypeConstraints LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as perl itself. AUTHOR
Robert "phaylon" Sedlacek <rs@474.at> COPYRIGHT AND LICENSE
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. perl v5.18.2 2013-12-21 MooseX::Types::Moose(3pm)
Man Page