[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
[ID 20000120.001] Diff to add print formatting to debugger
When I'm using the debugger there are a lot of times that I want to control
the format of the
output that is printed. For instance, I often want to see numbers in hex so
I type:
p sprintf "%x", $foo
to print the value of $foo in hex instead of decimal.
The following change the perl5db.pl allows a format option to be appended to
the print command
so you can do things like:
p%x $foo
or even
p%8.8x $foo
- Jim
===========================
1087a1088,1089
> $cmd =~ s/^p\%([^\s]+)$/print {\$DB::OUT} sprintf
\"\%$1\", \$_/;
> $cmd =~ s/^p\%([^\s]+)\b/print {\$DB::OUT} sprintf
\"\%$1\", /;
1855d1856
< B<p>B<\%fmt> I<expr> Same as \"I<print {DB::OUT} sprintf \"\%fmt\"
expr>\" in current package.
1891c1892
< B<p>[B<\%fmt>] I<expr> Print expression (uses script's current
package).
---
> B<p> I<expr> Print expression (uses script's current package).
- Follow-Ups from:
-
Ilya Zakharevich <ilya@math.ohio-state.edu>
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]