I am updating a few records in database. And all the processing is done in eval block.
The problem is that even if the records are successfully updated , I still see a exception being raised.
To debug the exception, I tried printing it using Data Dumper but the exception is blank.
Can any one please help me identify what is this error and why is it thrown every time ?
Environment Details (Perl 5.8 and Unix SUSE)
Dump from Data Dumper:
$VAR1 = '
';
I am using various internal APIs, to update these records.. so I have modified my code to look similar:
sub main{
eval{
DB->updateRecord($value)
};
if($@){
Mail->SendMail(__PACKAGE__,$@):
}
}
package DB;
sub updateRecord{
my ($self , $value) = @_;
my $query = "update set column_value = $value ..<update query> ";
API->processQuery($query );
}
Does your code
use warnings;?The symptom your describing indicated that in your code you are passing
diethe string"\n". My guess would be that in your source you have a line that is trying to die with an error message but your error message was not initialized. It could be something likeIf
some_test()passes butsome_other_test()fails the die will report an error containing only a new line. It would also emit an warning if warnings are enabled.Another possibility is a typo. If you don’t
use strict;the error variable might not be correct.Without
use strict;this can be an easy mistake to miss.