No need for default to be a sub when it just returns a string.
[gitmo/Moose.git] / lib / Moose / Meta / TypeCoercion / Union.pm
index 41395d8..1eef306 100644 (file)
@@ -5,10 +5,10 @@ use strict;
 use warnings;
 use metaclass;
 
-use Carp         'confess';
 use Scalar::Util 'blessed';
 
-our $VERSION   = '0.02';
+our $VERSION   = '0.57';
+$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,7 @@ sub compile_type_coercion {
 sub has_coercion_for_type { 0 }
 
 sub add_type_coercions {
-    confess "Cannot add additional type coercions to Union types";
+    Moose->throw_error("Cannot add additional type coercions to Union types");
 }
 
 1;
@@ -100,4 +100,4 @@ L<http://www.iinteractive.com>
 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