PDA

View Full Version : Where should this script be?


ronaldb66
07-17-2002, 01:41 PM
Hi all,

forgive my ignorance, but i'm totally unfamiliar with Perl/CGI. A friend of mine asked me how he should incorporate a couple of guestbook scripts, being made avialable by his ISP, into his site.

In the manual, a couple of examples listed, among other things, this link to view the guestbook contents:
<A HREF="/cgi-bin/gb_view.pl/guestbook/examplegb">View Guestbook</A>
I suppose a script called "gb_view.pl" is expected to be present in a cgi-bin directory under the current root, but i can't figure out what looks to me like yet another sub-directory "guestbook" is doing there. The manual also said to create a file called "examplegb.gb" in the directory where the guestbook resides ("examplegb.data"), but which directory are they referring to?!!

Can someone please enlighten me on this matter? Thanks in advance!

Mouldy_Goat
07-18-2002, 05:43 PM
What's happening here is that the CGI script is using a slightly unusual method of passing arguments to it...

If you call a script like this:
/cgi-bin/script.pl/guestbook/examplegb

Then a variable (I think it's called PATH_INFO) will be set in the %ENV hash which will give you '/guestbook/examplegb'.

You're probably more used to something like:
/cgi-bin/script.pl?path=/guestbook/examplegb

Essentially I think the 'examplegb' file should be in the 'guestbook' directory in this example, which should in turn be under the document root.

ronaldb66
07-23-2002, 01:15 PM
Mouldy_Goat,

thanks very much for replying; considering the number of views and the complete absence of replies, i was starting to question my post. Sorry for replying late, but i already sort of gave up hope on getting any response at all.
What you said makes good sense; if i understand correctly:

the directory structure under the document root and the files therein should look something like this:

[root]
|
cgi-bin: gb_view.pl
|
guestbook: examplegb.data
examplegb.gb

Again, thanks a lot! :D