igoryonya has asked for the wisdom of the Perl Monks concerning the following question:
The purpose is: If the program was launched from the console, it will be outputting directly to console. I mean, running with it's text version interface, but if it was launched from the GUI by a file manager or a shortcut, or whatever (NOT console), it will be launched in it's GUI Window (not text) interface with buttons etc.
I can't use ENV variable to test if it's console, because perl says that it's console, unless it's ran as a CGI.I know that it's possible, because, a long time ago, a Creative sound card came with a music player with the drivers installation. It could launch a text version of the player in the dos window when you type it's executable from the dos window, but when it was launched from the file manager by double-clicking on the executable, it launched it's GUI version.
So, in other words, when the script detects that it was being typed in the console to launch, it will use console interface subroutine (STDIN/OUT, etc.), but when it detects that it was launched not from the console, it will go to the Tkx subroutine for the GUI interface.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Detect Environment
by almut (Canon) on Dec 09, 2009 at 16:49 UTC | |
by Crackers2 (Parson) on Dec 09, 2009 at 17:01 UTC | |
by roboticus (Chancellor) on Dec 09, 2009 at 18:18 UTC | |
|
Re: Detect Environment
by ikegami (Patriarch) on Dec 09, 2009 at 17:32 UTC | |
by JadeNB (Chaplain) on Dec 10, 2009 at 01:14 UTC | |
|
Re: Detect Environment
by cdarke (Prior) on Dec 09, 2009 at 17:58 UTC | |
|
Re: Detect Environment
by GrandFather (Saint) on Dec 09, 2009 at 22:45 UTC |