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.
Look for Devel::TraceOps
on the CPAN in the next couple of weeks, followed perhaps by ExtUtils::NCI
.
Re:Level With Us
chromatic on 2006-01-09T21:30:37
It's sure not to make loads of money or to become famous. Of course, I was already writing some of these hacks before the book even came up....
Re:Level With Us
rooneg on 2006-01-09T22:43:35
You mean writing technical books doesn't make you rich and famous?!?! Damn it! Why didn't anyone tell me this before I wrote mine!;-)