limit number of args before formatting
authorJesse Luehrs <doy@tozt.net>
Wed, 7 Nov 2012 17:45:16 +0000 (11:45 -0600)
committerJesse Luehrs <doy@tozt.net>
Thu, 8 Nov 2012 02:28:03 +0000 (20:28 -0600)
this makes a difference when the number of args is quite large

dist/Carp/lib/Carp.pm

index b35ab69..23abb48 100644 (file)
@@ -162,12 +162,19 @@ sub caller_info {
                 = "** Incomplete caller override detected$where; \@DB::args were not set **";
         }
         else {
-            @args = map { Carp::format_arg($_) } @DB::args;
-        }
-        if ( $MaxArgNums and @args > $MaxArgNums )
-        {    # More than we want to show?
-            $#args = $MaxArgNums;
-            push @args, '...';
+            @args = @DB::args;
+            my $overflow;
+            if ( $MaxArgNums and @args > $MaxArgNums )
+            {    # More than we want to show?
+                $#args = $MaxArgNums;
+                $overflow = 1;
+            }
+
+            @args = map { Carp::format_arg($_) } @args;
+
+            if ($overflow) {
+                push @args, '...';
+            }
         }
 
         # Push the args onto the subroutine