From: Dave Rolsky Date: Mon, 22 Sep 2008 15:02:40 +0000 (+0000) Subject: First, fix confess() so it actually exists. I don't know how X-Git-Tag: 0.59~46 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5f223879d5e69a4c7e60a0158e5e2c3ac3e5bda6;p=gitmo%2FMoose.git First, fix confess() so it actually exists. I don't know how nothingmuch planned to implement switchign between throw_error() and confess() here though. --- diff --git a/lib/Moose/Util/TypeConstraints.pm b/lib/Moose/Util/TypeConstraints.pm index 39e2acf..d3d6dd7 100644 --- a/lib/Moose/Util/TypeConstraints.pm +++ b/lib/Moose/Util/TypeConstraints.pm @@ -247,6 +247,13 @@ sub normalize_type_constraint_name { return $type_constraint_name; } +sub _confess { + my $error = shift; + + local $Carp::CarpLevel = $Carp::CarpLevel + 1; + Carp::confess($error); +} + ## -------------------------------------------------------- ## exported functions ... ## -------------------------------------------------------- @@ -373,11 +380,13 @@ sub _create_type_constraint ($$$;$$) { if (defined $name) { my $type = $REGISTRY->get_type_constraint($name); - ($type->_package_defined_in eq $pkg_defined_in) - || confess ("The type constraint '$name' has already been created in " - . $type->_package_defined_in . " and cannot be created again in " - . $pkg_defined_in) - if defined $type; + ( $type->_package_defined_in eq $pkg_defined_in ) + || _confess( + "The type constraint '$name' has already been created in " + . $type->_package_defined_in + . " and cannot be created again in " + . $pkg_defined_in ) + if defined $type; } my $class = "Moose::Meta::TypeConstraint"; @@ -1034,17 +1043,6 @@ Adds C<$type> to the list of parameterizable types =back -=head1 Error Management - -=over 4 - -=item B - -If the caller is a Moose metaclass, use its L -routine, otherwise use L. - -=back - =head2 Namespace Management =over 4