I'm a devoted user of the -w switch. Probably the most common warning I get is:
Use of uninitialized value at foo.pl line 226, <F> chunk 115081.
It isn't always obvious which variable is uninitialized or why, so I run my script under the debugger. I then guess which variable on that line is uninitialized, and set a breakpoint, e.g.:
DB<2> b 226 !defined $foo1
DB<2> c
If I'm correct, the breakpoint is hit. If not, then I try the other variables until I find the one that is undefined. Alternately, I can assure myself of hitting the breakpoint by testing all the variables used on that line:
DB<2> b 226 !defined $foo1 || !defined $foo2 || !defined $foo3
Then I can display all of their values to see which one is undefined.
Either way is a pain. What I really want is a way to run my script under the debugger with the -w option, and simply tell it to break on any warning.
Anyone know how to do this?
- Chris
Use of uninitialized value at foo.pl line 226, <F> chunk 115081.
It isn't always obvious which variable is uninitialized or why, so I run my script under the debugger. I then guess which variable on that line is uninitialized, and set a breakpoint, e.g.:
DB<2> b 226 !defined $foo1
DB<2> c
If I'm correct, the breakpoint is hit. If not, then I try the other variables until I find the one that is undefined. Alternately, I can assure myself of hitting the breakpoint by testing all the variables used on that line:
DB<2> b 226 !defined $foo1 || !defined $foo2 || !defined $foo3
Then I can display all of their values to see which one is undefined.
Either way is a pain. What I really want is a way to run my script under the debugger with the -w option, and simply tell it to break on any warning.
Anyone know how to do this?
- Chris