Haven't ever used 'lock', but it is a perl function for use with
threading. I am using some of the code from the book, including the
function that you refer to. I just changed the subroutine name from 'lock'
to 'filelock'.

Eric

On Wed, 1 Aug 2001, Bertram, Paul wrote:

> Date: Wed, 1 Aug 2001 10:54:03 -0400
> From: "Bertram, Paul" <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: problems with Guestbook script from "Official Guide ... CGI.pm"
>
> Folks,
>
> I have been teaching myself CGI/Perl. I have Lincoln Stein's book "Official
> Guide to Programming with CGI.pm". I have been trying to get his
> "Guestbook.pl" script to work.
>
> As a good newbie, the first thing I did was add "-w" to the shebang line and
> "use strict;". I was surprised at the number of errors generated. I've
> worked through and fixed most of them (mostly undeclared global variables),
> but am stuck on two.
>
> 1. one error says "subroutine escapeHTML redefined at line149". To my
> inexperienced eyes, it looks like that is the only place it is defined, so
> why does perl think it is being redefined?
> (line numbers are after I added the use strict; and use vars qw() lines, so
> they wont match up with the online version).
>
> 2. The second error is: Too many arguments for lock at line 102 near "1)".
>     Here is sub lock:
>    sub lock {
>                     my $path = shift;
>                     my $for_writing = shift;
>                     my ($lock_type,$path_name,$description);
>
>                     if ($for_writing) {
>                                     $lock_type = LOCK_EX;
>                                     $path_name = ">>$path";
>                                     $description = 'writing';
>                     } else {
>                                     $lock_type = LOCK_SH;
>                                     $path_name = $path;
>                                     $description = 'reading';
>                     }
>
> The call to lock() is:
>             my $fh = lock($GUESTBOOKFILE,1);
>
> It looks to me like lock() requires two arguments and is supplied them by
> the call.
>
> Can someone see what I'm missing? I'm using ActiveState and Apache on a
> Win2000 machine.
>
> The whole script is online at
> http://www.wiley.com/legacy/compbooks/stein/text/guestbook.txt
> <http://www.wiley.com/legacy/compbooks/stein/text/guestbook.txt> .
>
> TIA,
> Paul Bertram, newer than most
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>

 Eric Wisti
 Kinetic, Inc.
 (651) 848-0477


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to