I have trouble caughting error during create object in Perl. My part of current code is like that:
#!/usr/bin/perl
use Mail::SpamAssassin::Client;
use warnings;
use strict;
my $client = new Mail::SpamAssassin::Client({port => 783, host => 'localhost'});
my $message = '';
if(!$result) {
print "Cant process a message ! Error: " . $result;
}
So I cant check $client variable if object has been created properly. Only I can check only $result variable after calling the method $client->process($message) But this is not satisfactory for me. Example if spammassassin daemon will be offline then I got communicate in terminal:
Failed to create connection to spamd daemon: Connection refused
Maybe can I catch this error message or error code after calling static method ?