From: Dave Rolsky Date: Tue, 16 Sep 2008 18:40:01 +0000 (+0000) Subject: add strict & warnings, tidy X-Git-Tag: 0.58~16 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c0e91e5f6d64984a080ffbffb28e7366c77dabb1;p=gitmo%2FMoose.git add strict & warnings, tidy --- diff --git a/lib/Moose/Error/Confess.pm b/lib/Moose/Error/Confess.pm index af27bb6..5dd2bfb 100644 --- a/lib/Moose/Error/Confess.pm +++ b/lib/Moose/Error/Confess.pm @@ -1,5 +1,8 @@ package Moose::Error::Confess; +use strict; +use warnings; + use base qw(Moose::Error::Default); __PACKAGE__ diff --git a/lib/Moose/Error/Croak.pm b/lib/Moose/Error/Croak.pm index 6ab52cb..1888998 100644 --- a/lib/Moose/Error/Croak.pm +++ b/lib/Moose/Error/Croak.pm @@ -1,5 +1,8 @@ package Moose::Error::Croak; +use strict; +use warnings; + use base qw(Moose::Error::Default); sub new { diff --git a/lib/Moose/Error/Default.pm b/lib/Moose/Error/Default.pm index f98a693..cd3421b 100644 --- a/lib/Moose/Error/Default.pm +++ b/lib/Moose/Error/Default.pm @@ -1,13 +1,16 @@ package Moose::Error::Default; +use strict; +use warnings; + sub new { my ( $self, @args ) = @_; - $self->create_error_confess( @args ); + $self->create_error_confess(@args); } sub create_error_croak { my ( $self, @args ) = @_; - $self->_create_error_carpmess( @args ); + $self->_create_error_carpmess(@args); } sub create_error_confess { @@ -19,15 +22,17 @@ sub _create_error_carpmess { my ( $self, %args ) = @_; my $carp_level = 3 + ( $args{depth} || 1 ); - local $Carp::MaxArgNums = 20; # default is 8, usually we use named args which gets messier though + local $Carp::MaxArgNums = 20 + ; # default is 8, usually we use named args which gets messier though my @args = exists $args{message} ? $args{message} : (); if ( $args{longmess} || $Carp::Verbose ) { local $Carp::CarpLevel = ( $Carp::CarpLevel || 0 ) + $carp_level; return Carp::longmess(@args); - } else { - return Carp::ret_summary($carp_level, @args); + } + else { + return Carp::ret_summary( $carp_level, @args ); } }