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: Beginner:
Flock Problem...

 



DippinPete
Deleted

Feb 9, 2001, 2:51 PM

Post #1 of 3 (432 views)
Flock Problem... Can't Post

Simple bit of code...

if ($coupon_id ne "")
{
open(COUP,"$ENV{'DOCUMENT_ROOT'}/cgi-local/coupdb.disc")||die "Can't Read file";
FLOCK(COUP,2);
@crecords=<COUP>;
FLOCK(COUP,8);
close(COUP);

Why would that cause the script to hang?

Pete




parham_m_s
journeyman

Feb 10, 2001, 11:11 AM

Post #2 of 3 (428 views)
Re: Flock Problem... [In reply to] Can't Post

I don't think flocking is the problem with that code... unless your on a windows server.

trying putting spaces between ") || die", you currently have it as ")||die "

for you if statement, to simplify, just do "if ($coupon) {" which would check to see if there is a value for $coupon.. hope that helped



(This post was edited by parham_m_s on Feb 10, 2001, 10:17 AM)


muinatit
Deleted

Feb 11, 2001, 6:09 PM

Post #3 of 3 (409 views)
Re: Flock Problem... [In reply to] Can't Post


Code
if ($coupon_id) { 
open (COUP, "$ENV{'DOCUMENT_ROOT'}/cgi-local/coupdb.disc") || die $!;
@crecords = <COUP>;
close (COUP);
}

You can simplify the if statement, like the man before me did, and you also don't need to flock a file if you're not going to write to it.

Jeffrey "muinatit" Lamoureux
muinatit@hotpop.com

 
 


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

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