in reply to Method references
This results in:#!/usr/bin/perl use strict; use warnings; use Try::Tiny; $main::errorA = 1; $main::errorB = 1; sub methodA { if ($main::errorA) { die "Something went wrong in methodA"; } } sub methodB { my ($handle) = @_; &$handle(); if ($main::errorB) { die "Something went wrong in methodB"; } } ## end sub methodB my $rowHandle = \&methodA; try { methodB($rowHandle); } catch { print ("ERROR: " . $_); }
|
|---|