in reply to Re: Perl/Tk run program
in thread Perl/Tk run program

That works great. Next, how do I get the process to run in the background and the perlrun to quit, without it stopping the program I just started. I am really new to perl and I do not know the commands. I have Learning Perl/Tk by Schwartz & Phoenix, O'reilly. Thank you for your help.

Replies are listed 'Best First'.
Re: Re: Re: Perl/Tk run program
by JamesNC (Chaplain) on Jul 29, 2003 at 04:16 UTC
    Try using backticks and you can bg it like you would any unix process from the command line, I am on WinXP and would probably use Win32::Process... but you can just do something like:
    my $rv = `someprog &`; # try this instead of your system() call...
    Since I am not on a Unix box that is an untested line
    Tk's main loop keeps running until you exit... There is a better way to do non-blocking system calls however... you should do some reading of the perl/tk faq's or read about it in Mastering Perl/Tk which is an O'Reilly book ( ISBN 1-56592-716-8) I believe the Schwartz book you are referring to is "Learning Perl". The Perl/Tk book is all about the Perl/Tk implementation and assumes you already are familiar with Perl.
    JamesNC
      JamesNC you gave me the idea to try the & inside my system call. I came up with this.
      system("$text &"); exit;
      I put this im my sub, and it works great. I am going to expand this to hold a history and add error checking for commands inputed to make sure they work and let you know if you get a command not found. Thank you for the idea JamesNC. Thank you