in reply to Re^7: How to detect X?in thread How to detect X?
use Sys::Hostname; sub run_with_gui { # returns boolean defined $ENV{'DISPLAY'} or return 0; my( $display ) = $ENV{'DISPLAY'} =~ /(.*):/; $display eq '' || $display eq hostname() } [download]