Where am I?

nicholas on 2008-04-24T16:13:15

(gdb) call Perl_eval_pv(my_perl, "Carp::cluck('Hello world!')", 0)
Hello world! at lib/File/Basename.pm line 52
        File::Basename::BEGIN() called at (eval 28) line 0
        eval {...} called at (eval 28) line 0
        require File/Basename.pm called at lib/File/Copy.pm line 55
        File::Copy::_catname('file-98616', 'lib') called at lib/File/Copy.pm line 112
        File::Copy::copy('file-98616', 'lib') called at lib/File/Copy.t line 125
$8 = (SV *) 0x1008e4838

Yes, it's logical, and I'm sure it's been done before, but I don't remember anyone noting it as a useful hack. Dear lazyweb, which prior art have I missed?


One that makes that substantially more useful

btilly on 2008-04-24T21:14:34

Whenever you're going to do a string eval, use a line directive to set the idea of filenames and line numbers to something useful (ie greppable). It is a ton easier to figure out what "Foo::Bar autogenerated by Baz" is than it is to determine what "eval 28" is.

(I got this tip from merlyn.)