From e7eb9d6b8a020c216e2fe51ba09dd7561a729258 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 7 Nov 2012 11:45:16 -0600 Subject: [PATCH] limit number of args before formatting this makes a difference when the number of args is quite large --- dist/Carp/lib/Carp.pm | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/dist/Carp/lib/Carp.pm b/dist/Carp/lib/Carp.pm index b35ab69..23abb48 100644 --- a/dist/Carp/lib/Carp.pm +++ b/dist/Carp/lib/Carp.pm @@ -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 -- 2.7.4