With the help of "smylers", I managed to create a poor man's version of strace for Perl. Basically, it's a touch of vim work with prints out almost every Perl line after that line is executed.
First, I add the following to the beginning of the program (though I put it all on one line):
use IO::Handle 'autoflush';
my $log = "db_upgrade.log";
open DEBUG_OUT, '>', $log or die $!;
autoflush DEBUG_OUT 1;
Then I type
\ s/.*/&\t\t\tprint DEBUG_OUT 'Line ' . __LINE__ . q(: &).\"\\n\"; # XXX debug/
\ \| %s/^\(\s*);\)\s*print DEBUG_OUT.*/\1/
I then run !perl -c % a few times (mapped to
It's a nasty hack and I really need to look into other options.
Note that you need to do less cleanup if you use a unicode character for the q'' delimeter in the mapping, but my vim was choking on that. If I take the trouble to turn this into a proper function, that would make things easier to fix (I can escape things which give me grief). Also, if you have multi-line strings which end with a semicolon (such as SQL often does), then this will likely break.