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
unexperienced eyes, it looks like that is the only place it is defined, so
why does perl think it is being redifined?
(line nubers 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 arguements 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.

TIA,
Paul Bertram, newer than most




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

Reply via email to