1
#!/usr/local/bin/perl -w
3
# Show how to set a watchpoint on a Tk Entry variable. Using this technique
4
# you can do data verification on the user's input. SOL
9
my $MW = MainWindow->new;
11
my $e = $MW->Entry(-textvariable => \$foo)->pack;
16
print "In store_callback, self=$_[0], new_value=$_[1].\n";
19
my $w = Tie::Watch->new(-variable => \$foo, -store => \&store_callback);
21
my $u = $MW->Button(-text => 'UnWatch $foo', -command => sub {
23
print "Unwatch() value=$foo.\n";
26
my $l = $MW->Button(-text => 'Quit', -command => sub {
27
print "Final value=$foo.\n";