I have a case where a local variable in a sub has the wrong un-blessed value after several invocations, and I'd like to break to the Perl debugger (when the program runs under debugger control, of course) if a specific condition is met.
I could try a conditional breakpoint interactively, but that would be a lot of typing work when repeating the "modify, debug" cycle many times.
Anyway I'd like to know whether its possible to use a construct like $DB::single=1 if (...);.
When I tried it, it did not work, and the breakpoint was active all the time.
So is it possible?
What I had tried
Basically my problem is that the line @l_socks = @{$lsa->sockets()}; triggered a "Can't call "sockets" on unblessed reference at ...".
As the code is in a subroutine that is called many times before the problem happens, I added $DB::single = 1 unless (ref $lsa); before the problematic line, but that did not work.
So maybe my problem is that $lsa is not a scalar as expected, but a reference; unblesswd however.