Help for this page

Select Code to Download


  1. or download this
    my $result = $object->method();
    unless(defined($result)) {
        $log->error("Something's gone wrong when called $object->method():
    + " . $object->error_message);
        # ...doing something with that...
    }
    
  2. or download this
    my $result = $object->method();
    if($object->has_error) {
        $log->error("Something's gone wrong when called $object->method():
    + " . $object->error_message);
        # ...doing something with that...
    }
    # ...doing something else, understanding that the method just doesn't 
    +have anything to pass to us...
    
  3. or download this
    my $result = eval { $object->method() };
    if($@) {
        $log->error("Something's gone wrong when called $object->method():
    + $@");
        # ...doing something with that...
    }
    # ...doing something else, understanding that the method just doesn't 
    +have anything to pass to us...