It's hard to be sure without seeing any code at all, as well as without seeing the actual error message. It sounds like you've got a lot of code, and you don't know really where the error is, so it's probably not practical to post a snippet until you've isolated where the problem is. But posting the actual error message could be helpful.

Here is my initial theory:

Update: See my update at the bottom of this post. I think it's more on the mark.

Your admin may have removed the definition of the CGI::Carp error handling routine that is assigned via CGI::Carp::set_message();

Here's an example. The following code executes properly if you uncomment the "carp_error" sub's definition. But we are looking for what might cause an error within the Carp module. So leave the error-handling sub commented out...:

use strict; use warnings; use CGI::Pretty; use CGI::Carp qw( fatalsToBrowser ); BEGIN { # sub carp_error { # my $error_message = shift; # my $cq = new CGI; # print $cq->start_html( "Error" ), # $cq->h1("Error"), # $cq->p( "Sorry, the following error has occurred: " ), # $cq->p( $cq->i( $error_message ) ), # $cq->end_html; # } CGI::Carp::set_message( \&carp_error ); } die $!;

If you call CGI::Carp::set_message(), passing it a reference to a nonexistant error-handling subroutine, you won't know there's a problem until the main script dies for some reason. And then, CGI::Carp tries to call that error-handling routine. And when the call fails because there is no routine, guess what?....

Content-type: text/html Undefined subroutine &main::carp_error called at C:/Perl/lib/CGI/Carp. +pm line 45 6.

Yup, the error message hails back to the Carp module.

Start by trying to figure out if there is a call to CGI::Carp::set_message(), and no definition of the error routine.

Update: I looked into the source on CGI::Carp. Line 301 is part of the sub import() definition. So whatever it is that your script is doing, it's causing an error to ripple into the import() method of CGI::Carp. merlyn (in the CB) had a brilliant suggestion (most of his are). ...make sure that you have a semicolon after use CGI::Carp;. Without one, it's possible that Perl is seeing the next line of code (up to the next semicolon) as an export list, causing the error you're seeing deep inside the CGI::Carp module.

use strict; might catch such an error earlier on by noticing a bareword.


Dave


In reply to Re: dying in the wrong place while using CGI::Carp by davido
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.