sub wrap { my ($r) = @_; return sub { print "Checking for pause...\n"; return $r->{subref}->(@_); }; } my $tied = wrap($r);