[comp.lang.perl] exec environment variables

bobd@magnus.ircc.ohio-state.edu (Bob DeBula) (01/11/91)

I am trying to write a very simplistic shell in PERL which
mainly exists to restrict the user to just one program.
What I need to know is how to pass a fake environment variable
(remember this PERL program is the shell) on to the program
I am calling so that the editor (VI) will believe that
$TERM is set to vt100.  Is this a brain dead idea to begin with?
Does anyone have or can provide an example?  Thanks in advance.

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

In article <1991Jan10.174034.21512@magnus.ircc.ohio-state.edu> bobd@magnus.ircc.ohio-state.edu (Bob DeBula) writes:
: I am trying to write a very simplistic shell in PERL which
: mainly exists to restrict the user to just one program.
: What I need to know is how to pass a fake environment variable
: (remember this PERL program is the shell) on to the program
: I am calling so that the editor (VI) will believe that
: $TERM is set to vt100.  Is this a brain dead idea to begin with?
: Does anyone have or can provide an example?  Thanks in advance.

#!/usr/bin/perl
$ENV{'TERM'} = 'vt100';
exec "program", "arg1", "arg2";

You could also say

#!/usr/bin/perl
exec "TERM=vt100 program arg1 arg2";

but that brings the shell into play, in which case you could have just
used a shell script in the first place.

Larry