in reply to Using Proc::Background and Win32

Hey Guys,

As I mentioned in a previous post I was trying to build this script and accompanying scripts/resources
into standalone executable file for Windows. I'm using the CavaPackager program in order to do this,
which also comes with a "Utility" Module called Cava::Packager which contains a bunch of methods you
can use along with your program.

For instance, all image files in my script are called "resources" by CavaPackager and you can set their
location with one of the methods in order for the program to include your virtual path to access these
files later. Well, there is also a method/function you use to execute scripts called from within other
scripts in your CavaPackager's "project".

And, for some reason if I use this Method/Function inside the Proc::Background function, it seems to work.
Even after I built the scripts into executables... The function is called "Cava::Packager::GetScriptCommand".

Here is my working code:
my $TIMEOUT = 30; my $proc; # This script is located in same dir as the calling script. my $bg_script = "bg_script.pl"; ......code..... ............... $proc = Proc::Background->new(Cava::Packager::GetScriptCommand( "$bg_s +cript", [], $ARG1, "$ARG2", $ARG3)); my $PID = $proc->pid; my $start_time = $proc->start_time; my $alive = $proc->alive; while($alive ne 0) { # This Checks again if it's still running... $alive = $proc->alive; # This while loop will force Perl::Gtk2 to continue processing # GUI Events while Background process continues executing... while (Gtk2->events_pending) { Gtk2->main_iteration; } Gtk2::Gdk->flush; $timeout_current = time; #->Sets the current time (EPOCH) # Get the difference in time from the current time and the # start time, to check if we hit the TIMEOUT limit of 30 sec $timeout_diff = $timeout_current - $timeout_start; # If the time difference is >= the TIMEOUT limit of 30 sec, then # use 'last' to break out of the loop... if ($timeout_diff >= $TIMEOUT) { $timed_out = 1; last; } # Sleep for 1000 milliseconds usleep(1000); }

So it seems that I am able to use Proc::Background after all...!

I just wanted to thank everyone for their replies, much appreciated!


Thanks Again,
Matt