From: Marcus Ramberg Date: Sat, 16 Oct 2010 15:53:53 +0000 (+0200) Subject: Add env variable for terse errors X-Git-Tag: 1.16~22 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=aeef093c02316557d8cffbd5bce3bbc02053d4e3;p=gitmo%2FMoose.git Add env variable for terse errors --- diff --git a/Changes b/Changes index 8cbf7e8..0254669 100644 --- a/Changes +++ b/Changes @@ -53,6 +53,9 @@ NEXT or lazy_build options for the attribute. Reported by Kent Fredric. RT #59613. (Dave Rolsky) + * Allow disabling stack traces by setting an environment variable. (Marcus + Ramberg) + 1.15 Tue, Oct 5, 2010 [API CHANGES] diff --git a/lib/Moose/Error/Default.pm b/lib/Moose/Error/Default.pm index 0c81d0e..9627564 100644 --- a/lib/Moose/Error/Default.pm +++ b/lib/Moose/Error/Default.pm @@ -12,11 +12,17 @@ use Class::MOP::MiniTrait; use base 'Class::MOP::Object'; + Class::MOP::MiniTrait::apply(__PACKAGE__, 'Moose::Meta::Object::Trait'); sub new { my ( $self, @args ) = @_; - $self->create_error_confess( @args ); + if(exists $ENV{MOOSE_ERROR_TERSE} && $ENV{MOOSE_ERROR_TERSE}) { + $self->create_error_croak( @args ); + } + else { + $self->create_error_confess( @args ); + } } sub create_error_croak { @@ -59,7 +65,9 @@ Moose::Error::Default - L based error generation for Moose. This class implements L based error generation. -The default behavior is like L. +The default behavior is like L. To override this +to default to L's behaviour on a system wide basis, +set the MOOSE_ERROR_TERSE environment variable to a true value. =head1 METHODS