Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi, there! I need some help on an issue that I have in my computers at home. I have 4 computers at home and I would like to control from my main computer the time that each person is allowed to use each computer. Also let who ever is using the computer to see like a timer with the amount of time the person has left until the computer locks. How and where could I start looking to start building an application like that using of course Perl?? Thank you all very much!!!

Replies are listed 'Best First'.
Re: Computer User Timer
by cbro (Pilgrim) on Jun 12, 2003 at 16:16 UTC
    I suggest Time::HiRes and the setitimer/getitimer functions. For docs go here.
    You could set the timer using setitimer. Then to display a a timer to the user, use getitimer and keep updating a formatted line via some method like 'formline' (which I use personally for displaying progress bars). Eventually, setitimer is going to send a SIG_ALARM, which you can catch in a subroutine that implements whichever method of 'stopping' the user from continuing to use the PC that you decide to use (e.g. I don't know what exactly to do to prevent access to the PC when the timer expires).

    HTH,
    Chris
Re: Computer User Timer
by tcf22 (Priest) on Jun 12, 2003 at 17:16 UTC
    If the machines are Win32 then you could use Win32::NetAdmin to disable the user account. Then when they are allowed back on, you could reenable it. I believe you have to set some flags in the UserSetAttributes method to disable accounts.