Jonathan -
thanks for the input. Actually I wanted to provide more details but I thought there would be a simple and standard solution for it (that I hadn't found.)
Anyway, I am working on a project for interfacing a simulation software, creating input files, processing output, scripting variations of parameters for huge numbers of batch simulations and all that.
For certain subprocesses (imaging, text editing, etc.) it would be useful to know whether X functionality is there or not. Example: do I launch vi or xedit, should I even try to display an image, start OpenDX or not, and so on.
I thought about an option, works for me. But since a group of people is using the tool, I want to make it as simple as possible.
What I have noticed - when started without X support - X applications sometimes just sit there as idle processes, not quitting with an error 'cannot open display etc...'. They accumulate and waste resources.
So maybe I should change my strategy - from highest-functionality to working-simple-but-by-default, the latter with explicit options to step up.
I thought that maybe a function/module would exist, returning true if X supported.
Thanks for your reply and ideas, Matthias
Jonathan Paton wrote:
is there a way to make a perl program find out whether a
valid X-Server is running?
I.e. $ENV{DISPLAY} is not a dummy address, if set.
Not in a useful way.
I have a headless (no monitor) Linux server, and a Windows desktop with a X win server. If I forget to run the X server it doesn't mean that DISPLAY contains a dummy address...
If a script made a guess at whether I wanted X functionality (say for installation), then it could get it wrong. That would be most annoying.
If a script wants to know if it can use the X server (or if one exists), then it should go ahead and try. If the toolkit returns an error then you know you don't have one.
In the situation you want to use X if available, terminal otherwise, wouldn't it be better just to use an option?
More detail, better answers!
Jonathan Paton
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>