Maybe you can help me a little further: I have the following code that just listens for files in the in directory. When it finds a file in the "in" directory it forks and then copies the file to the "out" directory where a system call to FTP the file takes place.

My problem is that it forks just fine and it starts to FTP the files using the FTP_Client.exe program, however I get all these error messages ("Free to wrong pool ... C:/Perl/lib/IO/Dir.pm") before the program crashes.

Can anyone see what I am doing wrong? I am new with PERL.

THanks,
Andrew
My PERL code:
use IO; use File::Copy; use Fcntl ':mode'; use warnings; use Net::ftp; use Net::Ping; use Time::localtime; use POSIX ":sys_wait_h"; system ("color 1f"); my $indir = ".\\in"; my $outdir = ".\\out"; my $expr = "*.*"; my $RemFile = "*.*"; my $d; if ( ! -e $indir ){ print "$indir does not exist, attempting to create\n"; mkdir ($indir, 0777 ) or die "Can not create $indir: $!"; } if ( ! -e $outdir ) { print "$outdir does not exist, attempting to create\n"; mkdir ($outdir, 0777 ) or die "Can not create $outdir: $!"; } while(1){ $d = new IO::Dir "$indir"; tie %dir, IO::Dir, "$indir"; foreach (keys %dir) { #if the expr is found in the InDir it will be FTP'd if( ! S_ISDIR($dir{$_}->mode) && /^$expr/ ) { if($pid = fork){ waitpid(-1, &WNOHANG); } else{ $RemFile = $_; #move the file to the out directory move( "$indir/$_", "$_"); #chdir ($outdir); print "Starting to FTP: $_\n"; system("FTP_Client.exe $_"); print "Finished: $_ \n\n"; move( "$_", "$outdir/$_"); exit(1); } } #sleep(5); } }

In reply to Re^2: Start windows .exe by amt35
in thread Start windows .exe by amt35

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.