Created
October 16, 2010 13:14
-
-
Save marcusramberg/629769 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/Moose/Error/Default.pm b/lib/Moose/Error/Default.pm | |
index 0c81d0e..bf68b4e 100644 | |
--- a/lib/Moose/Error/Default.pm | |
+++ b/lib/Moose/Error/Default.pm | |
@@ -12,11 +12,18 @@ use Class::MOP::MiniTrait; | |
use base 'Class::MOP::Object'; | |
+use constant MOOSE_ERROR_TERSE => $ENV{MOOSE_ERROR_TERSE}; | |
+ | |
Class::MOP::MiniTrait::apply(__PACKAGE__, 'Moose::Meta::Object::Trait'); | |
sub new { | |
my ( $self, @args ) = @_; | |
- $self->create_error_confess( @args ); | |
+ if(defined MOOSE_ERROR_TERSE && MOOSE_ERROR_TERSE) { | |
+ $self->create_error_croak( @args ); | |
+ } | |
+ else { | |
+ $self->create_error_confess( @args ); | |
+ } | |
} | |
sub create_error_croak { | |
@@ -59,7 +66,9 @@ Moose::Error::Default - L<Carp> based error generation for Moose. | |
This class implements L<Carp> based error generation. | |
-The default behavior is like L<Moose::Error::Confess>. | |
+The default behavior is like L<Moose::Error::Confess>. To override this | |
+to default to L<Moose::Error::Carp>'s behaviour on a system wide basis, | |
+set the MOOSE_ERROR_TERSE environment variable to a true value. | |
=head1 METHODS | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment