sub handler_gotLine { my ($kernel, $heap, $session, $arg, $exception) = @_[KERNEL, HEAP, SESSION, ARG0, ARG1]; if(defined $arg) { $heap->{wheel}->addhistory($arg); print "Very good, you entered '$arg'. You get another 10 seconds.$/"; } else { print "Got input exception '$exception'. Exiting...$/"; # setting this to undef will make our Wheel get shutdown $heap->{wheel}=undef; # setting a delay without a timeout number clears the event $kernel->delay('timeout'); return; } # run the prompt event again to reset timeout and print # new prompt $kernel->yield('prompt'); }