[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

RE: [ID 20000120.001] Diff to add print formatting to debugger





> -----Original Message-----
> From: Ilya Zakharevich [mailto:ilya@math.ohio-state.edu]
> Sent: Thursday, January 20, 2000 12:06 PM
> To: jbodwin@sebringring.com
> Cc: perl5-porters@perl.org
> Subject: Re: [ID 20000120.001] Diff to add print formatting to debugger
>
>
> a) If you want to send patches, use diff -pu or diff -p.


OK.  Here it is at the bottom.



b> ) If you want this, why not use aliases?

Aliases don't work for arbitrary command string.  I could do something like:

          =px p sprintf "\%x"

if I just want hex output but if I want to have more generic formats like

	p%8x

aliases won't work (unless I define every possible alias ala =p1x,
=p2x,....).

Also, this seemed like a generic enough extension that even if it was
possible
to do with aliases there is value to others in building it in In general I
prefer
the emacs approach - "build nothing in but provide the tools to do
anything".  However
generally useful stuff is often an exception.

  - Jim

=========================

$ diff -pu /tmp/perl5db.pl /perl/5.005/lib/perl5db.pl 
--- /tmp/perl5db.pl	Thu Jan 20 12:50:41 2000
+++ /perl/5.005/lib/perl5db.pl	Thu Jan 20 12:51:04 2000
@@ -1085,6 +1085,8 @@ EOP
 			      unless $hist[$i] =~ /^.?$/;
 			};
 			next CMD; };
+		    $cmd =~ s/^p\%([^\s]+)$/print {\$DB::OUT} sprintf
\"\%$1\", \$_/;
+		    $cmd =~ s/^p\%([^\s]+)\b/print {\$DB::OUT} sprintf
\"\%$1\", /;
 		    $cmd =~ s/^p$/print {\$DB::OUT} \$_/;
 		    $cmd =~ s/^p\b/print {\$DB::OUT} /;
 		    $cmd =~ /^=/ && do {
@@ -1852,6 +1854,7 @@ B<$psh> [I<cmd>] 	Run I<cmd> in subshell
 		See 'B<O> I<shellBang>' too.
 B<H> I<-number>	Display last number commands (default all).
 B<p> I<expr>		Same as \"I<print {DB::OUT} expr>\" in current
package.
+B<p>B<\%fmt> I<expr>	Same as \"I<print {DB::OUT} sprintf \"\%fmt\"
expr>\" in current package.
 B<|>I<dbcmd>		Run debugger command, piping DB::OUT to current
pager.
 B<||>I<dbcmd>		Same as B<|>I<dbcmd> but DB::OUT is temporarilly
select()ed as well.
 B<\=> [I<alias> I<value>]	Define a command alias, or list current
aliases.
@@ -1887,6 +1890,7 @@ I<Debugger controls:>                   
   B<q> or B<^D>     Quit			  B<R>	      Attempt a
restart
 I<Data Examination:>	      B<expr>     Execute perl code, also see:
B<s>,B<n>,B<t> I<expr>
   B<x>|B<m> I<expr>	Evals expr in array context, dumps the result or
lists methods.
+  B<p>[B<\%fmt>] I<expr>	Print expression (uses script's current
package).
   B<S> [[B<!>]I<pat>]	List subroutine names [not] matching pattern
   B<V> [I<Pk> [I<Vars>]]	List Variables in Package.  Vars can be
~pattern or !pattern.
   B<X> [I<Vars>]	Same as \"B<V> I<current_package> [I<Vars>]\".
$ 


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]