[100994] in RedHat Linux List
Re: WebServer-CGI scripts: I m running to the Library, but..
daemon@ATHENA.MIT.EDU (Thomas Ribbrock \(Design/DEG\))
Tue Nov 24 06:05:02 1998
Date: Tue, 24 Nov 1998 11:06:09 +0000
From: "Thomas Ribbrock \(Design/DEG\)" <argathin@iname.com>
To: redhat-list@redhat.com
Mail-Followup-To: redhat-list@redhat.com
In-Reply-To: <199811240200.VAA13984@smtp2.erols.com>; from Charles Galpin on Mon, Nov 23, 1998 at 08:54:39PM -0500
Resent-From: redhat-list@redhat.com
Reply-To: redhat-list@redhat.com
Charles Galpin writes:
[...]
> Now back to cgi programs. When you are just starting they are difficult to
> test because you cannot just run them from the command line like other perl
> scripts because you the web server sets up various environment variables for
> you, and as a beginner I just suggest the following strategy. Start small,
> and make small incremental changes, testing them frequently. When things go
> wrong, there will be only a few lines changed that could be to blame.
[...]
Testing from cgi scripts the command line is easy, if you use the Perl CGI
library. I'm not sure whether it's part of the standard perl distribution,
but if not, it should be reasonably easy to find on any CPAN server (take
http://language.perl.com/ as a start). Using this library, my first lines
(after the #!..... line) in a cgi script are always these:
use CGI qw(:all);
use CGI::Carp qw(fatalsToBrowser);
This has to very nice effects: a) errors that occur while running the cgi
script from a web page will be returned to the browser and b) you can run
the cgi script from the command line and it will ask you for parameters and
their values, so you can simulate a call from an actual browser.
I found this to be extremely helpful during debug sessions.
You can check if this library is installed by looking into your perl library
directory (I'd suspect it's /usr/lib/perl, but I'm not sure, as I currently
don't have a Linux machine available here at work) and look for a
subdirectory called CGI and a file called CGI.pm. If you have those, the
library should be installed.
HTH,
Thomas
--
"Look, Ma, no obsolete quotes and plain text only!"
Thomas Ribbrock | http://www.bigfoot.com/~kaytan | ICQ#: 15839919
"You have to live on the edge of reality - to make your dreams come true!"
--
PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
http://www.redhat.com http://archive.redhat.com
To unsubscribe: mail redhat-list-request@redhat.com with
"unsubscribe" as the Subject.