ginocapelli has asked for the wisdom of the Perl Monks concerning the following question:
I am new to this and know that there are probably some bugs. It does work, but only if there are 2 $$'s side by side on line 22, when I am telling it to flock each file it creates. AND, when I am connected via FTP (WS_FTP), run the script, and then try to open the "hits" folder, it doesn't show the new files, it hangs until I hit refresh... but it doesn't seem to be doing this for any other directories. Thought maybe it was just a fluke that the server was slowing down everytime I was trying to open that directory, maybe it is... the possibilities are endless!!!! Can someone tell me what I am doing wrong? Thanks! Edited by boo_radley for formatting#!/usr/bin/perl my $adfile = '/home/ebrae2/adskingston-www/cgi-bin/ebrae/data/ads.data +'; my $hits_dir = '/home/ebrae2/adskingston-www/cgi-bin/ebrae/hits/'; open(FILE, $adfile) || die "Can't open $adfile"; flock FILE, 2; while ($line = <FILE>) { chomp $line; my @counter_file = split(/\|/,$line); open (HITS_FILE, ">$hits_dir/$counter_file[0].txt") || die "Can't op +en $adfile"; ("$hits_dir/$counter_file[0].txt"); print HITS_FILE "0"; close (HITS_FILE); if ($os eq "unix") { chmod 0666, "$hits_dir/$$counter_file[0].txt"; } } close FILE; if ($os eq "unix") { chmod 0666, "$adfile"; } print "Content-type: text/html\n\n"; print "<BR><CENTER>"; print "<form><input type=button value=\"Success!\" onClick=\"locatio +n.href('http://www.adskingston.com')\"></FORM>";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(bbfu) Re: using loop/array to write files
by bbfu (Curate) on Sep 09, 2001 at 22:09 UTC | |
by Anonymous Monk on Sep 09, 2001 at 22:42 UTC | |
by tilly (Archbishop) on Sep 09, 2001 at 23:11 UTC | |
|
Re: using loop/array to write files
by mandog (Curate) on Sep 09, 2001 at 22:26 UTC | |
|
Re: using loop/array to write files
by mandog (Curate) on Sep 09, 2001 at 22:49 UTC | |
by ginocapelli (Acolyte) on Sep 10, 2001 at 03:47 UTC | |
by ginocapelli (Acolyte) on Sep 10, 2001 at 04:51 UTC |