I’m teaching a co-worker of mine some perl. He has a script that currently goes through each file in a directory and processes the files. In order to process each file he has to execute several SQL statements to different servers. To speed things up he would like to process several files at a time (but he wants to be able to understand what the script does). Since fork doesn’t work I split the program into 2 parts. The first part reads each file in the directory and then launches the second script with the filename as the parameter, but in order to start the second program in the background I used eval (system calls are not run in the background). Here is a condensed version of my first program:
# part1.pl use strict; my ($file, $string); my @files = (“test1.txt”,”test2.txt”,”test3.txt”); for $file (@files){ $string = "open (A$file, \"perl part2.pl $file|\")"; eval $string; # Error checking omitted for simplicity }
More or less, I’m looking for a better way to solve this problem on a Win32 platform. Any thoughts and ideas are welcome. c-era

In reply to Background processes in Win32 by c-era

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.