This just popped into my head after reading Jarko's RFC.  I had some
DBI heavy code which was making use of RaiseError.  So like a good
programmer I'd wrapped all my DBI code in eval blocks.  However, there
were a few cases where I forgot to check $@ after a block!  This
allowed errors to silently be ignored and caused me a few hours of bug
tracking.

My thought: I'll tie $@ so that if its ever STOREd twice without a
FETCH between I'll get a warning telling me about the location of the
first STORE.  That should be the eval block I forgot to check.  Not
the greatest scheme in the universe, but it should work (assuming even
a successful eval block sets $@).  Something similar could also be
done with $!and maybe $?, providing a better indication of whether or
not a system call has been checked.

Problem is, you can't tie $@.  Perl silently ignores it.  I'm sure
this can be changed in perl6.

Anyhow, its not perfect, but the basic idea of looking for a double
STORE on an error variable without a FETCH between might prove useful.


-- 

Michael G Schwern      http://www.pobox.com/~schwern/      [EMAIL PROTECTED]
Just Another Stupid Consultant                      Perl6 Kwalitee Ashuranse
But why?  It's such a well designed cesspool of C++ code.  Why wouldn't
you want to hack mozilla?
                -- Ziggy

Reply via email to