Leser: 13
1 2 3 4 5 6 7 8 9 10 11 12 13
use strict; use warnings; print_bon(); print "Action 1\n"; print "Action 2\n"; print "Action 3\n"; sub print_bon { sleep 3; print "Ausdruck\n"; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
use strict; use warnings; use Tk; use threads; my $cnt = 0; my $mw = MainWindow->new(); $mw->Button( -text => 'print', -command => sub { my $time = localtime(); $cnt++; threads->new(\&print_bon, $cnt, $time); }, )->pack(-anchor => 'center', -pady => '2'); MainLoop; sub print_bon { my $cnt = shift; my $time = shift; sleep rand(10); print "Ausdruck $cnt ($time)\n"; }