Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
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]"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Carp croak not working when used in an imported function
by ikegami (Patriarch) on Sep 29, 2006 at 23:10 UTC | |
|
Re: Carp croak not working when used in an imported function
by mreece (Friar) on Sep 29, 2006 at 22:49 UTC | |
by shenme (Priest) on Sep 29, 2006 at 23:04 UTC | |
by fmerges (Chaplain) on Sep 29, 2006 at 23:25 UTC | |
by Anonymous Monk on Sep 29, 2006 at 23:12 UTC | |
|
Re: Carp croak not working when used in an imported function
by diotalevi (Canon) on Sep 29, 2006 at 23:33 UTC |