Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Setting TERMINAL_EMULATOR to vt100

by zuinc (Novice)
on Apr 16, 2002 at 14:28 UTC ( [id://159496]=perlquestion: print w/replies, xml ) Need Help??

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

In order to run my script the environment variable, TERMINAL_EMULATOR must be set to vt100. So I wrote the following line of code in my script:
system("set term = vt100");
I also tried:
system("setenv TERMINAL_EMULATOR vt100");
Neither works and the error message I keep getting back is "Cant exec 'setenv': No such file or directory at ./myscript line 5."
Any suggestion??? Thanks

Zuinc

Replies are listed 'Best First'.
Re: Setting TERMINAL_EMULATOR to vt100
by Fletch (Bishop) on Apr 16, 2002 at 14:40 UTC

    perldoc perlvar, look for %ENV. What you're trying (unsuccessfuly) to do is starting a new shell, setting a variable, and then that shell exits. This leaves your environment unchanged. Not to mention the fact that system() usually runs /bin/sh instead of csh.

    perldoc -q environment may also be tangentally of interest.

Re: Setting TERMINAL_EMULATOR to vt100
by vagnerr (Prior) on Apr 16, 2002 at 14:41 UTC
    It won't work anyway because system forks another process to run so your command is executed in that new process and updates the environment of that new process. The new process then exits and the settings you have made are lost :-}

    One thing to try (I've not tested this) is to update the @ENV array. But if you are using it to have a perl script update your settings then before running something else you will find that the changes are again lost when the script exits.

    ---If it doesn't fit use a bigger hammer
Dealing with environment variables (boo)
by boo_radley (Parson) on Apr 16, 2002 at 14:47 UTC
    here's a hint : print join "\n", keys %ENV
    Still need more? perlvar is your friend.
Re: Setting TERMINAL_EMULATOR to vt100
by perigeeV (Hermit) on Apr 16, 2002 at 20:40 UTC

    Well, how to do it has been sufficently explored, but I might warn you that simply setting the TERM environment is not usually enough for most interfaces. I don't know what you're doing, but be aware that whatever is reading your TERM will expect your script to process that terminal type's escape and control codes. This may or may not be an issue for you. I have actually run into programs that restricted access based on terminal type as a simple security measure.


Re: Setting TERMINAL_EMULATOR to vt100
by zentara (Archbishop) on Apr 16, 2002 at 16:31 UTC
    You could export a variable in .bashrc to get it to set in the %ENV. Then you could reset it later. This will affect all new terminals being opened. system(" echo export TERMINAL_EMULATOR=vt100 >>.bashrc") But you should reset it after your program is done.
Re: Setting TERMINAL_EMULATOR to vt100
by coreolyn (Parson) on Apr 16, 2002 at 16:54 UTC

    Hrmmm seems to me that $ENV{'TERMINAL_EMULATOR'}=vt100 should do what you want.

    coreolyn

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://159496]
Approved by jlk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-03-28 14:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found