Skip to content
Browse files

avoid an uninit warning when Test::Builder not in play

  • Loading branch information...
1 parent 4515821 commit 9d505ba21874c29405dbda02c9956b833aa73f78 @rjbs committed
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/Test/Fatal.pm
View
4 lib/Test/Fatal.pm
@@ -132,7 +132,9 @@ sub exception (&) {
my $code = shift;
return try {
- my $incremented = $Test::Builder::Level - $REAL_CALCULATED_TBL;
+ my $incremented = defined $Test::Builder::Level
+ ? $Test::Builder::Level - $REAL_CALCULATED_TBL
+ : 0;
local $Test::Builder::Level = $REAL_CALCULATED_TBL;
if ($incremented) {
# each call to exception adds 5 stack frames

0 comments on commit 9d505ba

Please sign in to comment.
Something went wrong with that request. Please try again.