Hello List,
I am using a module that does use Carp; and you
can specify whther you want croak or carp on an error
Which is cool. But there is no way to specify anythign
else besides those two.
So the way it is you just do:
my $res = funktion('foobarmonkey',err_doer => 'carp');
And it will do
carp('what the heck is foobarmonkey');
What I'd like to do is get any errors into a variable:
my $err = '';
my $res = funktion('foobarmonkey',err_doer => 'puterrorinvar');
if($err) {
print "Error: $err\n";
print "Logging error..."'
if(logerror($err) { print "Ok\n"; } else { print "Failed!\n"; }
print "Emailing Admin...";
if(emailadmin($err)) { print "Ok\n"; } else { print "Failed!\n"; }
# and now that we did that we can go ahead and carp, craok die, whatever
}
Except I can't simply specify a new function for errors because it checks for what you
enter to see if its in a hash and if not defaults to one or the other. (I could modify
the module but then it won't work for all)
SO I guess the question is, is there a way to get carp or croak into a variable?
Something like this perhaps: ?
my $err = '';
putcarpinvar_on(\$err); # this is an example to illustrate what I'm shooting for it
is not real
my $res = funktion('foobarmonkey',err_doer => 'puterrorinvar');
putcarpinvar_off(\$err); # this is an example to illustrate what I'm shooting for it
is not real
if($err) { ...
Any ideas?
TIA
Dan
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>