Something like this: ################################### package wxtimer; use strict; use Wx qw/:everything/; use base 'Wx::Timer';
sub new { my $class = shift; my %args=@_; my $parent=delete $args{parent}; my ($parent_id, $type)=find_parent->new($parent); my $timer_id=delete $args{timer_id}; my $this = $class->SUPER::new($parent_id, $timer_id); bless $this, $class; if(exists $args{callback}){ $this->{callback}=delete $args{callback}; Wx::Event::EVT_TIMER($parent_id, $timer_id , $this->{callback} ); } return $this; } ################################### $this->{launch_timer}=wxtimer->new( parent=>"TOP", timer_id=>1, callback=>sub { $this->{timer_set}=0; } ); # only allow the user to launch 1 instance of the app every 2 seconds. to avoid accidental multiple clicks if(!$this->{timer_set}){ $this->{timer_set}=1; $this->{launch_timer}->Start(2000, wxTIMER_ONE_SHOT); system($app_fullpath); } On Sun, 2011-02-27 at 19:35 -0700, Jon Aykroyd wrote: > Hello All, > > can someone please assist me in using wxTimer. I don't understand how to > create a timer object and trigger an event. > > I'm attempting to use a timer with this code: > http://pastebin.com/AYDNHHWT > > Thanks, > Jon > > > ______________________________________________________________________ > This email has been scanned by the MessageLabs Email Security System. > For more information please visit http://www.messagelabs.com/email > ______________________________________________________________________