In CGI::Carp, line 301 looks like this:
sub realdie { CORE::die (@_); }
The updated die calls realdie.
With the help of a colleague, we concluded that the program actually dies in the body of this realdie. This is why we see the .../CGI/Carp.pm file name and the 301 line number.
If I copy this code to my script and use this subroutine, the problem is duplicated. The script appears to die in the body of new realdie.
Do you agree with my diagnosis? Is this a bug in CGI::Carp? How can I fix realdie so I uses the right file and line number?