I'm writing Perl Hacks (<TorgoX>All must buy!</TorgoX>) and in the process I'm coming across some really dusty corners of Perl.
One of my long-planned hacks was on tracing your code down at the opcode dispatch level -- who needs a debugger when you have something this cool -- using pure Perl. Of course, if I want to make this work correctly, I can't write pure Perl. That's fine. I'm a polyglot. I can handle a little C and XS.
When I hit the part tonight where my Perl callback was somehow, in some circumstances, getting a null op instead of the
B::* object I expected, I started to debug my XS code, trying all sorts of permutations of creating the object, throwing in the magic XS incantations to manage the stack and reference count, and so on. I even went as far as to use the
Devel::Peek equivalent in C.
I had no luck until I looked at the Perl code again and realized I was accidentally calling my callback from Perl without passing any values. ~bonk~
I can only defend myself by explaining that not only is figuring out exactly when this code takes over from the normal Perl runloop a bit tricky (as if the description alone weren't enough to scare almost everyone else away), but dodging segfaults always makes me woozy, and oh yeah is this difficult to test in process.
Devel::TraceOps on the CPAN in the next couple of weeks, followed perhaps by