package ClassB; sub method_y { if($something_has_gone_wrong) { confess("Something has gone wrong!"); } } package ClassA; sub method_x { try { $class_b_object->method_y; } catch { confess($_); } } package main; try { $class_a_object->method_x } catch { $log->error($_); }