Doesn't your initial explanation imply that we uncovered a bug? die doesn't correct the stack trace properly when called within an eval. If a recent update involves the ineval() method, that would explain why the die method use to work until the admin guy updated the module. Anyway, try this code segment. I left work early today, but I was able to recreate the problem on my machine at home.
#!/usr/bin/perl use strict; use CGI::Carp qw(fatalsToBrowser warningsToBrowser); eval { die "Ouch"; }; if ($@) { print $@, "\n"; } eval { my_die("Ouch"); }; if ($@) { print $@, "\n"; } sub my_die { my ($arg) = @_; if (CGI::Carp::ineval) { $arg = join("", @_); my($file,$line,$id) = CGI::Carp::id(1); $arg .= " at $file line $line." unless $arg=~/\n$/; if ($arg !~ /\n$/) { $arg .= "\n"; } CGI::Carp::realdie $arg; } if (!ref($arg)) { $arg = join("", @_); my($file,$line,$id) = CGI::Carp::id(1); $arg .= " at $file line $line." unless $arg=~/\n$/; &fatalsToBrowser($arg) if $CGI::Carp::WRAP; if (($arg =~ /\n$/) || !exists($ENV{MOD_PERL})) { my $stamp = CGI::Carp::stamp; $arg=~s/^/$stamp/gm; } if ($arg !~ /\n$/) { $arg .= "\n"; } } realdie $arg; }

In reply to Re: Re: Re: Re: dying in the wrong place while using CGI::Carp by esharris
in thread dying in the wrong place while using CGI::Carp by esharris

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.