LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Perl file locking

[ILUG] Perl file locking

frank.05 at neo.tamu.edu frank.05 at neo.tamu.edu
Wed Jul 25 17:58:19 IST 2001


I have a problem with one of my scripts.
I have tried to lock a datafile but when when the script is executed there is no data saved on the specified files.
Can anyone help me out? i have checked my permisions and evrything is set ok.

here is part of the script

sub lock 
   {
	flock (DATAFILE, 2);
	seek (DATAFILE, 0, 2);
   }
sub unlock
   {
	 flock (DATAFILE, 8);
   }
 
sub write_data
   {
	$i=1; 
 open(DATAFILE, ">>/data.txt");
 open(LOG_OUT,">>/data.log");
 print LOG_OUT "$response{$i}:";
   $i++;    
 while ( $item{$i} gt " ")
       {
         print DATAFILE "$response{$i}:";
         print LOG_OUT  "$response{$i}:";
	 $i++;
       }

print LOG_OUT "\n";
   close(DATAFILE);
   close(LOG_OUT);   
       }

lock(DATAFILE);
 &write_data;
unlock(DATAFILE);





More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell