And there's a Perl 6 way of doing it:
# Perl 6 my $init_value = 42; my $checked = new Proxy: FETCH => { $init_value }, STORE => -> $new { die "Error: New value must be defined!\n" unless defined $new; $init_value = $new; };
See S06 for more information on the Proxy object.
--Ingo
In reply to Re: Returning a tied scalar
by iblech
in thread Returning a tied scalar
by MarkusLaker
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |