use Wx qw(:everything); use Wx::Locale qw(:default); use Wx::Event qw(:everything); my $hApp = Handler->new(); $hApp->MainLoop(); package Handler; use strict; use Wx qw(:everything); use Wx::Event qw(EVT_TIMER); use base qw(Wx::App); sub new { my ($class) = @_; my $this = $class->SUPER::new(); return $this; } sub OnInit { my ($this) = @_; $this->{hWnd} = Wx::MessageDialog->new(undef, 'Timer Message'); $this->{wId} = Wx::NewId(); $this->{hTimer} = Wx::Timer->new($this, $this->{wId}); $this->{hTimer}->Start(1000); EVT_TIMER($this, $this->{wId}, \&OnTimer); return 1; } sub OnTimer { my ($this, $hEvent) = @_; # Stop Timer while processing $this->{hTimer}->Stop(); if (-e 'c:/winzip.log') { unlink 'c:/winzip.log'; } $this->{hWnd}->ShowModal(); # Restart Timer for more $this->{hTimer}->Start(1000); }