Suppose you read from that socket and do the processing in a sub.
This sub is called somewhere in the main program, probably from a menu.
You pass a reference to the MainWindow to the sub and inside the sub you call update(), like this:
. . .
my $menu = $menubar->Menubutton(qw/Name menu -tearoff 0 -text somethin
+g -underline 0 -menuitems/ =>
[
[command => 'read socket', -command => [\&read_socket, $MW]],
]
)->pack(-side => 'left');
. . .
sub read_socket {
my $MW = shift;
while (some_condition) {
do_something_with_socket;
$MW->update();
}
}
|