perlstrace

How to find the current step the running perl script is executing?


I have a huge Perl script,which many times it hangs, When it's in running state, I need to find out, which step it's now executing.

I don't want Devel::Trace [compile time entity]. Is there anything like strace kind of thing? To which I can pass the pid of the script and it will show me, what is it executing at run time?


Solution

  • What's a "step"?

    You mentioned strace, and strace traces system calls. If that's what you want, go a head and use strace. It works perfectly fine with Perl.

    If you want to trace which Perl statement is executing, you could run the script in perl -d, the Perl debugger. It has a trace feature. This function is also provided by Devel::Trace through a trivially simple interface.

    (I have no idea what problem you have with Devel::Trace. You seem to imply it doesn't show what statements get executed as they get executed, but that's exactly what it does.)