I think the bottom line here is that CGI::Carp is kind of brittle and unreliable, and only works well for simple things. Using real exception handling, where you wrap your calls in eval {} and then catch the exceptions in your CGI script or command-line script and handle them appropriately, is the next level. There is more discussion of this
here.