in reply to subprocess delay on Windows with Perl/Tk

Backticks are for capturing the output from something (and hence will wait until the child returns before continuing). You probably want to look at one of the Win32::* modules (Win32::Process maybe) and use that instead (or system and/or fork/exec on a real OS).

Replies are listed 'Best First'.
Re^2: subprocess delay on Windows with Perl/Tk
by kgoess (Beadle) on Jun 03, 2004 at 18:58 UTC
    Thanks. Win32::Process works, but I'd have to know the full path to excel.exe. "start" lets the file type registry on the client pc take care of finding excel ("start" also takes care of forking and returns immediatly, the Tk program doesn't have to wait for excel to exit, although in this case *everthing* is waiting for excel to *start*).

    Backticks with `start file.csv` work fine as long as the Tk event loop isn't running. I'd still like to hear if anyone else has the same problem.

      Win32::Process works, but I'd have to know the full path to excel.exe.

      That's not hard to find.

      use File::Spec; sub find_in_path { my $prog = shift; my $fmm; for my $d (File::Spec->path()) { $fnm = File::Spec->catfile($d,$prog); last if -x fnm; $fnm = undef; } return $fnm; } my $excel = find_in_path('excel.exe');
      90% of every Perl application is already written.
      dragonchild
        Thanks, but that's assuming excel.exe is in your path. It's typically not, rather it's typically in some place like c:\Program Files\Microsoft Office\Office10\. That's the case with most Windows packages that you'd install.
      If that's a problem for you, then use system or fork/exec.

      MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
      I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
      ** The third rule of perl club is a statement of fact: pod is sexy.