Hi,

I'd like to upload a module to assist during the debugging phase,
nothing really new :

the module will provide :

* a watch() function to carp a message on every
access to the variable.
Yes the idea is borrowed from the monitor package described in
'Advanced programming in Perl' from Sriram Srinivasan, but I've tried to
simplify its use : 'watch($x)' is all you have to do (compare to
'monitor(\$x, "x")') and I'd like to make it more cutomizable (by
allowing to set the messages carped, or choose the output...)
* a wait() function which will carp/croak when a var reach a predefined
value
* an assert() function which will die if the cond isn't verified on the
current line (Yes I know Carp::Assert exists)
* a print() function (see below for why I redefine it)

* some other useful functions (yet to be determined :-)


I know all of this already exist, but AFAIK there isn't any module with
all this features available, and they are necessary to me for an efficient
debug.

Furthermore, and I won't hide it's the main Idea behind this module,
all these functions are called through a special interface :

every function is called throught comments !

use MyDebug;

my $a; # watch($a)
my $b; # wait($b,==,2)

The main advantage to my mind (let apart it gives me a good reason to
play with Filter::Simple ;-) is that I can bring code from test
to prod environement with only one line to comment out
(the 'use Mydebug;' line)
I prefer this over the usual $DEBUG var triggering debug code beccause
the Filter approach allow me to 'hide' more the debugging code.
Furthermore the Filter's use helps to simplify things for the user by
hiding all the technicals details...
Only the program logic remains with no 'debugging noise'

A lot of people pointed me to to others way to do it (Attributes...)
but I'd really like to explore this way.
(That doesn't mean that your comments aren't welcome !)

So what name could I use for this module, as it's  more or less an
experiment I'd prefer a low-profile name (let's avoid 'Debug'  :-)
If anyone has an Idea which can suggest the use of the 'stealth'
interface, please feel free to tell it.

Yet I only came up with 
Filter::Debug (but T'm not satisfied with it as it seems to suggest
Debugging the Filter module...)
or
MyDebug


TIA

Arnaud ASSAD

PS: As I already said any comment is welcome (why it's stupid/good,
suggestion for other useful functions...)

Reply via email to