CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Just wanna make sure .....

 



perlkid
stranger

Sep 17, 2000, 8:16 PM

Post #1 of 3 (384 views)
Just wanna make sure ..... Can't Post

 
Hi, I'm just making sure that this code is ok.

I'm using it and I'm not having any problems but it's my first time using flock. Let me know if I'm not locking the files properly.

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


open(data, "<bla.db");
flock data, LOCK_SH;
@all=<data>;
flock data, LOCK_UN;
close(data);
</pre><HR></BLOCKQUOTE>

When I write to a file I use,

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


open(data, ">bla.db");
flock data, LOCK_EX;
@all=<data>;
flock data, LOCK_UN;
close(data);
</pre><HR></BLOCKQUOTE>

Thanks,

perlkid


dws
Deleted

Sep 17, 2000, 8:24 PM

Post #2 of 3 (384 views)
Re: Just wanna make sure ..... [In reply to] Can't Post

In the second code fragement, you probably want to print to, not read from, the filehandle.

Check error returns!

Other than that, looks O.K.


perlkid
stranger

Sep 18, 2000, 10:39 AM

Post #3 of 3 (384 views)
Re: Just wanna make sure ..... [In reply to] Can't Post

 
OOps, He he,

Silly me,

I cut and pasted that code from the first one and forgot to change that, he he.

Thanks Dws,

perlkid

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives