Home > Archive > PERL CGI Beginners > May 2004 > Template
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Werner Otto 2004-05-24, 8:30 am |
| Hi there,
How to I include or call another cgi script from a current one. I want to
create say a header script that I just want to include it when I want to.
What does the syntax look like?
Regards
Otto
| |
| Jan Eden 2004-05-24, 9:30 am |
| Hi Werner,
Werner Otto wrote on 24.05.2004:
>Hi there,
>
>How to I include or call another cgi script from a current one. I want to=
=20
>create say a header script that I just want to include it when I want to.=
=20
>What does the syntax look like?
>
>Regards
>Otto
>
How about HTML::Template? It was written for exactly that purpose.
- Jan
--=20
There's no place like ~/
| |
| Bill Jones 2004-05-24, 5:30 pm |
|
--- Werner Otto <wot@dcs.kcl.ac.uk> wrote:
> Hi there,
>
> How to I include or call another cgi script from a current one.
> What does the syntax look like?
Don't do it that way; See perldoc require
That is what I would recommend - otherwise you would need to have the
"called" cgi call your original script again -- OR, you can simply do
this (as an example only and not called as a cgi - there isn't any need
to do it that way) --
if (condition) {
# Rebuild each Categories index.html file...
chdir("/HR/AP");
system("/rt/apache2/cgi/CreateIndexes.pl AP > /HR/AP/index.html");
}
If you *must* try it as a cgi, then use the HTTP Location header like
this:
print "Location
/cgi/some.cgi?SomeParams=SomeData&someotherParams=SomeotherData\n\n";
exit;
You have to exit the current CGI as there is no way to get back to it -
the WWW is stateless in this regard. That is why I strongly recommend
doing what you are attempting in one stroke.
(PS - What Jan suggested really is the best way IMHO.)
HTH/Bill
=====
-Sx-
s ing employment: http://youve-reached-the.endoftheinternet.org/
__________________________________
Do you Yahoo!?
Yahoo! Domains – Claim yours for only $14.70/year
http://smallbusiness.promotions.yahoo.com/offer
|
|
|
|
|