Diff for /db/prgsrc/counter7.pl between versions 1.1 and 1.4

version 1.1, 2001/12/31 18:05:16 version 1.4, 2002/01/03 18:03:53
Line 1 Line 1
 #!/usr/bin/perl  #!/usr/bin/perl
 $wait=3;  $wait=3;
 $cfile  = 'counts/count7.txt';  
 open STDERR, ">errors";  
 $lockdir="c:/html/countdir/";  
 $l = lc $ENV{'DOCUMENT_NAME'};  
 $header="Content-Type: text/html\n\n";  $header="Content-Type: text/html\n\n";
 &lockfile && (print $header.'?? раз', exit);  print $header;
   
   $cfile  = 'count7';
   $cfiledir = '/home/piataev/public_html/cgi-bin/counts7';
   chdir $cfiledir;
   
   open STDERR, ">errors" or print "Oppa";
   $lockdir="";
   $lockdir=$cfiledir;
   $l = lc $ENV{'DOCUMENT_NAME'};
   if ($a=&lockfile)
     { print "$a ?? раз"; 
       exit ;
     }
   
 open(F, $cfile);  open(F, "$cfile");
 @DATA = <F>;  @DATA = <F>;
 close(F);  close(F);
 foreach (@DATA) {  foreach (@DATA) {
Line 17  foreach (@DATA) { Line 26  foreach (@DATA) {
   {    {
     $c++;      $c++;
     $_ = "$c - $bl\n";      $_ = "$c - $bl\n";
     $tmp = "cfile$$.tmp";      $tmp = "$cfile$$.tmp";
     open(F, ">$tmp");      open(F, ">$tmp");
     print F @DATA;      print F @DATA;
     close(F);      close(F);
     rename("$tmp", $cfile);      rename("$tmp", $cfile);
     print $header.$c. " раз".&Suffix($c);      print "$c раз".&Suffix($c);
     &unlockfile ;      &unlockfile ;
     exit      exit
   }    }
Line 32  open(F, ">>$cfile"); Line 41  open(F, ">>$cfile");
 print F "1 - $l\n";   print F "1 - $l\n"; 
 close(F);  close(F);
   
 print $header."первый раз";  print "первый раз";
 &unlockfile;  &unlockfile;
   
 sub lockfile  sub lockfile
 {    {  
    $tmp="$lockdir$cfile$$.tmp";     $tmp="$cfile$$.tmp";
    $lock="$lockdir$cfile.loc";     $lock="$cfile.loc";
    open F,">$tmp" or return 1;     open F,">$tmp" or (print $@,return 1);
    print F $$;     print F $$;
    close F;     close F;
    if (-e $lock) {     if (-e $lock) {

Removed from v.1.1  
changed lines
  Added in v.1.4


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>