I am importing a function called "errmsg" into my module. This function formats my error messages, specifically it handles dies. This function lives in a helper module.
The main module dies via "errmsg" when someone passes the wrong argument to a method.
The problem is that the error is always reported as happening in the module and not in the program that calls the method with the wrong argument. So I am trying to use Carp's croak function, but it is not working right.
In my "errmsg" function, I am using 'Carp::croak'. (I have to qualify it because CGI::Carp is also importing croak apparently.) Is there something I need to add to 'Carp::croak' to get it to report the error as I want it? Thanks. Example code:
sub errmsg {
Carp::croak "$_[0]";
}