X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FTypeCoercion%2FUnion.pm;h=cbd2c1e1f7c2037b53ac0927eae807e3ebc26b36;hb=baf46b9edc7dc3665c7eaf9d1684b157efb09e1a;hp=716176512a61d179c90d7f048d1887afa515099f;hpb=eaa35e6e0f9132abf6ed0cec60515dd7259ce704;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/TypeCoercion/Union.pm b/lib/Moose/Meta/TypeCoercion/Union.pm index 7161765..cbd2c1e 100644 --- a/lib/Moose/Meta/TypeCoercion/Union.pm +++ b/lib/Moose/Meta/TypeCoercion/Union.pm @@ -5,10 +5,10 @@ use strict; use warnings; use metaclass; -use Carp 'confess'; use Scalar::Util 'blessed'; -our $VERSION = '0.50'; +our $VERSION = '0.72_01'; +$VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::TypeCoercion'; @@ -18,8 +18,8 @@ sub compile_type_coercion { my $type_constraint = $self->type_constraint; (blessed $type_constraint && $type_constraint->isa('Moose::Meta::TypeConstraint::Union')) - || confess "You can only a Moose::Meta::TypeCoercion::Union for a " . - "Moose::Meta::TypeConstraint::Union, not a $type_constraint"; + || Moose->throw_error("You can only a Moose::Meta::TypeCoercion::Union for a " . + "Moose::Meta::TypeConstraint::Union, not a $type_constraint"); $self->_compiled_type_coercion(sub { my $value = shift; @@ -43,7 +43,8 @@ sub compile_type_coercion { sub has_coercion_for_type { 0 } sub add_type_coercions { - confess "Cannot add additional type coercions to Union types"; + require Moose; + Moose->throw_error("Cannot add additional type coercions to Union types"); } 1; @@ -58,26 +59,25 @@ Moose::Meta::TypeCoercion::Union - The Moose Type Coercion metaclass for Unions =head1 DESCRIPTION -For the most part, the only time you will ever encounter an -instance of this class is if you are doing some serious deep -introspection. This API should not be considered final, but -it is B that this will matter to a regular -Moose user. - -If you wish to use features at this depth, please come to the -#moose IRC channel on irc.perl.org and we can talk :) - +This is a subclass of L that is used for +L objects. =head1 METHODS =over 4 -=item B +=item B<< $coercion->has_coercion_for_type >> + +This method always returns false. + +=item B<< $coercion->add_type_coercions >> -=item B +This method always throws an error. You cannot add coercions to a +union type coercion. -=item B +=item B<< $coercion->coerce($value) >> -=item B +This method will coerce by trying the coercions for each type in the +union. =back @@ -93,11 +93,11 @@ Stevan Little Estevan@iinteractive.comE =head1 COPYRIGHT AND LICENSE -Copyright 2006-2008 by Infinity Interactive, Inc. +Copyright 2006-2009 by Infinity Interactive, Inc. L This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. -=cut \ No newline at end of file +=cut