[Classiccity-pm] Timeout
Stephen Howard
stephen at enterity.com
Thu Mar 2 09:41:12 PST 2006
The only thing that comes immediately to mind is to have an external
program throw a signal at your script, which it can then can catch,
check if input has been provided, and otherwise kick the user off the
system. This external program could be a couple of things:
- a child that forks off right before the read for STDIN, which signals
it's parent when the time is up.
- a daemon that the script signals right before the STDIN read. The
script would indicate to the daemon when it would like a wake up call
You might also see if POE has something that could help. I understand
it's interrupt/event driven:
http://poe.perl.org/
HTH
-Stephen
Linda Dubes Law wrote:
> Paul Keck made me join this list because he was jealous of Leslie Grove
> because she got to have all the fun of helping me solve all of my
> interesting perl problems. Just kidding.
>
> Here is today's problem:
>
> Running on HP/UX, certain users login and are thrown into a perl menu
> script. They can go from there to other perl scripts that I want to time
> out after a very short time compared to the menu. They can also go to third
> party software but always end up back at this menu and thrown out of the
> system when they quit the menu. The third party software has its own
> timeout function that works great and has to stay because many of the users
> only see the third party software. Not everyone gets the pleasure of seeing
> the results of my scripts.
>
> Anyway, is there something that I can put between these two lines that will
> kick the user out of the system while the script is waiting for input?
>
> print "\n\n Q or q to quit : ";
>
> chomp ($task = <STDIN>);
>
>
> Thanks,
>
> Linda Law
>
> **************
>
> #!/usr/contrib/bin/perl
>
> use Shell;
>
> # $SIG{INT} = 'IGNORE';
>
> while ($task ne 'Q' and $task ne 'q')
> {
>
> system (clear);
>
> print " BULLDOG BUCKS MAIN MENU\n\n";
>
> print " 1. Go to the OPTIM program\n";
> print " 2. Add 1 card holder to the system\n";
> print " 3. Add a Library Print and Copy Card Range\n";
> print " 4. *Add 1 Departmental Card\n";
> print " 5. *Add Housing Summer Camp Card Range\n";
> print " 6. *Change Plan and Reset Balance for 1 Cardholder\n";
> print " 7. *View and/or print last daily email sent to a location\n";
> print " 8. *Get Cardholder Notes by Status Code and Date\n";
> print " 9. Lock a user account\n";
> print " 10. Unlock a user account\n";
>
> print "\n\n * indicates the option is not yet ready for use.";
>
> print "\n\n Q or q to quit : ";
>
> chomp ($task = <STDIN>);
>
> SWITCH:
> {
> ($task eq '1') && do {
>
> _______________________________________________
> Classiccity-pm mailing list
> Classiccity-pm at pm.org
> http://mail.pm.org/mailman/listinfo/classiccity-pm
More information about the Classiccity-pm
mailing list