in reply to Wierd Behavior With Tie
In 5.6.1, even the first call doesn't work (Can't use an undefined value as a subroutine reference).
Using
my $sub = $tied; print $sub->(5), "\n";
fixed the problem in both places. It seems that $var->() and &{$var}() doesn't check if $var is tied.
Anyway, you don't have to use tie at all:
sub wrap { my ($r) = @_; return sub { print "Checking for pause...\n"; return $r->{subref}->(@_); }; } my $tied = wrap($r);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Wierd Behavior With Tie
by rational_icthus (Sexton) on Jun 02, 2006 at 18:19 UTC | |
by ikegami (Patriarch) on Jun 02, 2006 at 19:40 UTC | |
by rational_icthus (Sexton) on Jun 02, 2006 at 22:49 UTC |