Sherm Pendley wrote:
> writes:
>
> > Problem: I am having trouble figuring out why a system call in the
> > background *always* returns 0. Debian Linux Perl 5.8.7
> >
> > What am I trying to do: I am trying to launch a browser from a perl/Tk
> > button and it always returns 0 (and hence prints the failed to open
> > browser message)
>
> As the docs for system() state, a return value of 0 does not indicate failure:
>
> perldoc -f system
>
That is correct - 0 should indicate success - this is why I have if
(!$return) - i.e. for a non-zero return print the error message. The
problem is - no matter what happens a 0 *always* gets returned. I threw
in a false location of /usr/bin/firfox (note the e is missing) but a 0
gets returned (indicating success) but no window get launched obviously
as there is no such executable (firfox) on my system.
I beginning to wonder what the "success" indicator of 0 points to? Ok
- so I found this in the docs:
"The return value is the exit status of the program as returned by
the "wait" call. "
So I look up perldoc -f wait and see this:
"The status is returned in $?"
So - again checking $? gives a value of zero.
Let's start from the beginning and hopefully someone can answer one
specific question:
How do I launch a browser as a background process and *know* whether or
not it was launched?
Jack