[comp.lang.perl] Perl shell and autologout

eastick@me.utoronto.ca (Doug Eastick) (01/15/91)

I'm writing a simple shell/menu-system using perl.  The menu will
probably look something like this:
	
	M) Mail
	N) News
	S) Shell
	L) Logout

	Choice>> _

How can I implement an autologout (this perl program is their login
shell) similar to csh?  It'll be a vanilla 4.2 BSD system on a ns32k.
Me thinks there is a fork() involved.

Also, any tips or hazards I should be aware of using a Perl program as
a login shell?

lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (01/16/91)

In article <91Jan15.065631est.19297@me.utoronto.ca> eastick@me.utoronto.ca (Doug Eastick) writes:
: I'm writing a simple shell/menu-system using perl.  The menu will
: probably look something like this:
: 	
: 	M) Mail
: 	N) News
: 	S) Shell
: 	L) Logout
: 
: 	Choice>> _
: 
: How can I implement an autologout (this perl program is their login
: shell) similar to csh?  It'll be a vanilla 4.2 BSD system on a ns32k.
: Me thinks there is a fork() involved.

If you have a recent version, you can just call alarm($SECONDS) right
before you prompt, and either let the signal blow you away, or set
$SIG{'ALRM'} = 'HANDLER';

: Also, any tips or hazards I should be aware of using a Perl program as
: a login shell?

You'll want to give them a way to set up their environment, probably.
As long as the script isn't running as root there should be no problem,
but if it happens to be running setuid, be careful what you eval.  taintperl
can help some if that's the case.

Larry