in reply to Re: Re: Running or not running
in thread Running or not running

If you're starting the .go files from within your Perl script, you should be able to start them up with system, and when that function returns the program is complete.

Replies are listed 'Best First'.
Re: Re: Re: Re: Running or not running
by Anonymous Monk on May 13, 2004 at 13:26 UTC
    Ok this is what I did
    #! c:\perl\bin $|++; use strict; use vars qw /%data/; $data{apps_list} = shift @ARGV; system (cls); print "\n\nPath to apps list => ". $data{apps_list}."\n"; open (LST, "$data{apps_list}") || die "$! : File was not found\n"; chomp (@{$data{Go_scripts}} = <LST>); for my $item (@{$data{Go_scripts}}) { print "\n$item\n"; system ($item); if (system() ==0) # this is incorrect { print "\n Done\n"; } else { print "Failed\n"; } }
    Obviously it doesn't work because of the "if (system() ==0)" which is not correct, but the correct way of this is what I am trying to achieve!

    Any Thoughts?

    TIA

      from system:

      You can check all the failure possibilities by inspecting $? like this:
      if ($? == -1) { print "failed to execute: $!\n"; } elsif ($? & 127) { printf "child died with signal %d, %s coredump\ +n", ($? & 127), ($? & 128) ? 'with' : 'without +'; } else { printf "child exited with value %d\n", $? >> 8; }

      Do you want the following?

      system($item); # evaluate status $? according to perldoc -f above

      regards,
      tomte


      An intellectual is someone whose mind watches itself.
      -- Albert Camus