P
Paul Faulstich
I am writing a script that checks an environment variable and, if it
is set, will re-run itself in debug mode.
I have this working fine under win32 and unix when its launched from
the command line, but if an X-windows program launches it, it doesn't
know to first open up an xterm and run itself in that.
How can I get perl to either
- check to see if it was launched under X-windows, OR
- attempt to launch the Xterm by default, and if it fails then try to
run directly through the stdin/out
For what its worth, the current code snippet below. Comments,
derision, etc are welcomed.
Thanks,
Paul Faulstich
(e-mail address removed)
if ($ENV{LLB_DEBUG_TRIGGERS} and ! $PERLDB) {
my @cmd = ($EXECUTABLE_NAME, "-d", "-w", $PROGRAM_NAME, @ARGV);
my @run;
if (MSWIN) {
@run = ("START", "/WAIT", join(" ", @cmd), @cmd);
} else {
# attempt to initiate an X-windows session. If this fails,
then
# attempt to run directly
# gotta fill this in so it works from xwindows.
@run = @cmd;
}
my $result = system (@run);
exit $result;
}
obviously, MSWIN is defined outside of this and I 'use English;'
is set, will re-run itself in debug mode.
I have this working fine under win32 and unix when its launched from
the command line, but if an X-windows program launches it, it doesn't
know to first open up an xterm and run itself in that.
How can I get perl to either
- check to see if it was launched under X-windows, OR
- attempt to launch the Xterm by default, and if it fails then try to
run directly through the stdin/out
For what its worth, the current code snippet below. Comments,
derision, etc are welcomed.
Thanks,
Paul Faulstich
(e-mail address removed)
if ($ENV{LLB_DEBUG_TRIGGERS} and ! $PERLDB) {
my @cmd = ($EXECUTABLE_NAME, "-d", "-w", $PROGRAM_NAME, @ARGV);
my @run;
if (MSWIN) {
@run = ("START", "/WAIT", join(" ", @cmd), @cmd);
} else {
# attempt to initiate an X-windows session. If this fails,
then
# attempt to run directly
# gotta fill this in so it works from xwindows.
@run = @cmd;
}
my $result = system (@run);
exit $result;
}
obviously, MSWIN is defined outside of this and I 'use English;'