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

I've been trying to convert an old command line run perl script to perl/cgi. I've come across a bit of a snag. Part of my script needs to open a ds9 window (it needs to run, but not necessarily be displayed). Apparently this requires a window server to be available for rendering (X11?).
The original script runs flawlessly through a command line on the computer hosting the cgi script. In my perl cgi script, I have tried to call ds9 using backticks or system commands (eg `ds9 -dsssao coord $RA $DEC sexagesimal -catalog save tsv /tmp/tempGS.tsv -quit &`; This command opens a ds9 window, prints some info to a text file and then closes the ds9 window). I receive the following errors in my error logs:
'xhost: unable to open display "", Application initialization failed'
Does anyone know if it is possible to open a window server through a perl cgi script. Any help would be greatly appreciated. Thanks

Replies are listed 'Best First'.
Re: perl/cgi and x11
by andal (Hermit) on Mar 01, 2012 at 09:29 UTC

    This is not really perl question. Maybe you can find the answer here http://hea-www.harvard.edu/RD/ds9/faq.html Check the section "Is it possible to work in batch mode without a physical display?". Probably, you'll find this http://fixunix.com/xwindows/91428-xvfb-dummys.html also helpful.

      Thanks so much. Somehow I overlooked Xvfb in my searches for a solution. It was exactly what I needed. I am now able to run ds9 without a display with the virtual frame buffer. Appreciate the help.
Re: perl/cgi and x11
by kcott (Archbishop) on Mar 01, 2012 at 09:28 UTC

    The error message "xhost: unable to open display "", ..." suggests to me that $ENV{DISPLAY} is undefined or set to an empty string. A fairly typical value for that environment variable is '0:0'.

    X11 seems appropriate. What system are you running on?

    -- Ken