Choosing the extension of your CGI scripts depends on your web server configuration. Without knowing more about that, it's difficult to assist you.
Most issues are tangentially related to Perl (but lots of people here do have experience with these sorts of things). The first resource I ever used is this FAQ (don't let the name throw you).
You will probably want to start your script with:
#!/usr/bin/perl -wT
use strict;
use diagnostics;
use CGI;
I have not read your book. If it does not explain strict and CGI.pm, it is probably incomplete and may lead you astray. We can provide you with links to more complete information if this is the case. | [reply] [Watch: Dir/Any] [d/l] |
I agree with chromatic's post.
Check out CGI.pm and also
Check out Ovid's CGI Course
Lot's of great info there. I've not read that book either, but I'd use CGI.pm for getting values from web forms, it only takes a couple of lines of code.
To answer your question though, it usually doesn't matter if you call it *.pl or *.cgi. Try both to see if the script works on your web server, if so then use whatever you're comfortanble with.
Good Luck | [reply] [Watch: Dir/Any] |
I have not heard of that book or that author, which is a
really bad sign for its quality. (There are a lot of Perl
books out there. Most are written by incompetent people.)
Even worse signs are the phrases "Perl 5" and "web
programming". I usually take both as danger signs of
books written more to hit the right buzzwords than to
teach anything useful.
The fact that its name sounds like it might be the same
book specifically mentioned by redmist in (redmist) RE: Essential Perl 5 for Web Professionals
as a really bad book is an even more ominous sign.
Your comment that you are using its code for reading forms
suggests very strongly that the book rolls its own code for
processing CGI. This is sure-fire test that tells you it
is complete and utter crap whose only redeeming quality is
that you can entertain yourself destroying it. (Please do
not succumb to the temptation to recoup your losses by
selling it to some other unsuspecting soul who can be
damaged by it.) | [reply] [Watch: Dir/Any] |
This book is available on Amazon (but I don't shop at Amazon). However, I have concerns about it. From the Amazon site:
From the Publisher
With a review by Tom Christiansen, one of the original Perl founders, this is one of the most comprehensive books on the market, covering Perl OOP structure, socket programming, HTML conversions, building Internet search utilities, and more! - Focuses heavily on the Windows NT version of Perl
Offhand, that almost seems reasonable, but I noticed that it didn't explicitly state that Tom Christiansen wrote what's mentioned. I suppose I'm just being cynical.
Reading through the reviews is not reassuring. They talk about the book being "confusing" and the general opinion seems to be that it's a decent book, but tough to follow. Of course, the reviews for Elizabeth Castro's pitiful excuse for a CGI book are pretty glowing, so I take them with a grain of salt. You can compare them to my dissenting viewpoint.
The major thing that gives me pause it the mention by one reader that the book was published in 1996. I currently have CGI Programming with Perl (2nd edition), but I also have the first edition of that work. They are very, very far apart in terms of quality. The first edition often ignores many of the things we take for granted: strict, taint checking, CGI.pm, etc. Older books on Internet programming, while they may have been "decent" for their time, are generally to be avoided.
Of course, who's going to listen to me after my major brain cramp on this post? :)
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
| [reply] [Watch: Dir/Any] |