Re: Book: guestbook.cgi

1999-12-14 Thread Doug MacEachern

On Sun, 12 Dec 1999, Michael Dearman wrote:

> I've copied example 4-15 and multi-checked it, for the
> past couple of days. Finally used a copy of the example
> obtained from the book site. But still have problems.

modperl.com has the book source tarball, including a newer version of the
guestbook than the (broken) example in the book.



Re: Book: guestbook.cgi

1999-12-12 Thread Aaron Turner

On Sun, 12 Dec 1999, Michael Dearman wrote:

> 
> Spotted this
> 
> sub view_guestbook {
>   my $show_sign_button = shift;
>   print start_form,
>   submit(-name => 'Sign Guestbook'),   <<<
>   end_form if $show_sign_button;
>   ...
> 
> changed to
>   submit(-name => 'action', -value => 'Sign Guestbook'),

[snip]

> Could someone please confirm if this is the code in their book?
> (book == Writing Apache Modules with Perl and C, March 1999 -
> first edition.)
> 

On both page 158 and 154, it's:
submit(-name => 'Sign Guestbook'),

--
Aaron Turner, Core Developer   http://vodka.linuxkb.org/~aturner/
Linux Knowledge Base Organization  http://linuxkb.org/
Because world domination requires quality open documentation.
aka: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]



Re: Book: guestbook.cgi

1999-12-12 Thread Michael Dearman


Spotted this

sub view_guestbook {
my $show_sign_button = shift;
print start_form,
submit(-name => 'Sign Guestbook'),   <<<
end_form if $show_sign_button;
...

changed to
submit(-name => 'action', -value => 'Sign Guestbook'),

And at least the forms behave correctly. Still not sure
if the many logs about subroutine redefines should be happening.

Could someone please confirm if this is the code in their book?
(book == Writing Apache Modules with Perl and C, March 1999 -
first edition.)

Thanks for your patience,
M. Dearman



Book: guestbook.cgi

1999-12-12 Thread Michael Dearman

I've copied example 4-15 and multi-checked it, for the
past couple of days. Finally used a copy of the example
obtained from the book site. But still have problems.

[note: the example from the book sight used strftime(time, '%D')
in sub write_guestbook. Changing that to strftime('%D', localtime)
helped]

Using apache 1.3.9 and mod_perl 1.21.

With 'use strict' there is this error:
Can't use string ("1") as a symbol ref while "strict refs" in use 
at .

That's a 1 (one) used by 'sub lock()', given as the second arg
as a flag to turn on an exclusive lock on the file.

There are other warnings, and another error when I comment out
'use strict' - like:
Can't call method "close" without a package or object reference at ...

But any help on that first error would be appreciated.

I've tried this script in the cgi-bin dir and a perl/ dir I've used
to run all the other example .pl scripts. In each dir the .htaccess
file given in the book was used. Permissions checked. But just to make
sure, a PerlSetVar GuestbookFile /usr/local/apache/projects/guests.txt
was added to the appropriate directives in httpd.conf for the
the cgi-bin directory, and in the perl.conf for the perl dir.

in httpd.conf

AllowOverride All   # added this
Options None
Order allow,deny
Allow from all
PerlSetVar GuestbookFile /usr/local/apache/projects/guests.txt # added
this


in perl.conf
Alias /perl/ /usr/local/apache/perl/

AllowOverride All
SetHandler  perl-script
PerlHandler Apache::Registry
PerlSendHeader  On
Options +ExecCGI
PerlSetVar  GuestbookFile /usr/local/apache/projects/guests.txt


Or where and how should I be trying to run this script?

Appreciate any help.
Thanks,
M. Dearman