summaryrefslogtreecommitdiff
path: root/lib/perl5db.pl
diff options
context:
space:
mode:
authorShlomi Fish <shlomif@shlomifish.org>2012-11-18 12:14:12 +0200
committerTony Cook <tony@develop-help.com>2013-01-02 11:22:06 +1100
commitb747a9b0bf3c21193c812b1e8bf81786837cc6bf (patch)
treee1d3e70cc30fb0c910df165fd1426d23e303ef7a /lib/perl5db.pl
parentfdada06c5258f8fdf3b379dc05a1d7faf415f0fc (diff)
downloadperl-b747a9b0bf3c21193c812b1e8bf81786837cc6bf.tar.gz
Extract _dump_trace_calc_saved_single_arg.
Diffstat (limited to 'lib/perl5db.pl')
-rw-r--r--lib/perl5db.pl66
1 files changed, 35 insertions, 31 deletions
diff --git a/lib/perl5db.pl b/lib/perl5db.pl
index d32e1cbf4a..7bf7177d62 100644
--- a/lib/perl5db.pl
+++ b/lib/perl5db.pl
@@ -6463,45 +6463,49 @@ stack frame. Each has the following keys and values:
=cut
-sub _dump_trace_calc_save_args {
- my ($nothard) = @_;
+sub _dump_trace_calc_saved_single_arg
+{
+ my ($nothard, $arg) = @_;
- my @a;
- for my $arg (@args) {
- my $type;
- if ( not defined $arg ) { # undefined parameter
- push @a, "undef";
- }
+ my $type;
+ if ( not defined $arg ) { # undefined parameter
+ return "undef";
+ }
- elsif ( $nothard and tied $arg ) { # tied parameter
- push @a, "tied";
- }
- elsif ( $nothard and $type = ref $arg ) { # reference
- push @a, "ref($type)";
- }
- else { # can be stringified
- local $_ =
- "$arg"; # Safe to stringify now - should not call f().
+ elsif ( $nothard and tied $arg ) { # tied parameter
+ return "tied";
+ }
+ elsif ( $nothard and $type = ref $arg ) { # reference
+ return "ref($type)";
+ }
+ else { # can be stringified
+ local $_ =
+ "$arg"; # Safe to stringify now - should not call f().
- # Backslash any single-quotes or backslashes.
- s/([\'\\])/\\$1/g;
+ # Backslash any single-quotes or backslashes.
+ s/([\'\\])/\\$1/g;
- # Single-quote it unless it's a number or a colon-separated
- # name.
- s/(.*)/'$1'/s
- unless /^(?: -?[\d.]+ | \*[\w:]* )$/x;
+ # Single-quote it unless it's a number or a colon-separated
+ # name.
+ s/(.*)/'$1'/s
+ unless /^(?: -?[\d.]+ | \*[\w:]* )$/x;
- # Turn high-bit characters into meta-whatever.
- s/([\200-\377])/sprintf("M-%c",ord($1)&0177)/eg;
+ # Turn high-bit characters into meta-whatever.
+ s/([\200-\377])/sprintf("M-%c",ord($1)&0177)/eg;
- # Turn control characters into ^-whatever.
- s/([\0-\37\177])/sprintf("^%c",ord($1)^64)/eg;
+ # Turn control characters into ^-whatever.
+ s/([\0-\37\177])/sprintf("^%c",ord($1)^64)/eg;
- push( @a, $_ );
- } ## end else [ if (not defined $arg)
- } ## end for $arg (@args)
+ return $_;
+ }
+}
+
+sub _dump_trace_calc_save_args {
+ my ($nothard) = @_;
- return \@a;
+ return [
+ map { _dump_trace_calc_saved_single_arg($nothard, $_) } @args
+ ];
}
sub dump_trace {