On Wed, 2007-04-18 at 11:30 +0300, Tsantilas Christos wrote:

>    Here is a perl script which can be used to convert debug statements 
> to new debugs statements :-) .
> It mostly works or just  do standard errors.
> It does not formats the output. I think the astyle can do the rest work.
> Does not convert the debug statements, if the format string contains 
> formating flags like "%2.1f".

If you get a chance, please modify the script debugging/logging to use
one line for both the conversion status and the debug statement:

Found:     $line\n
Converted: $mod_statement\n
LeftAsIs:  $line\n

This way it is much easier to grep/see debug statements that were _not_
converted, for example.


A few minor suggestions, if I may:

You may want to replace \d* in a line format with \w+ because the
arguments are required and sometimes contain variable names rather than
constants.

You may want to replace space and tab characters in the format with \s.

If you are not using a matched string, no need to use parens. For
example, this may work:
  if ( $line =~ /\sdebug\(\s*\w+\s*,\s*\w+\s*\)/ ) 


Thank you,

Alex.


Reply via email to