Try perl -c scriptname on the server.
where do I do that?
You need a shell account on the server.
This is getting slightly out of hand ...
I got this to work:
But when I add:
it shows the error:
So it must be the something wrong I'd think with
The param() method is defined in the CGI library. You are not getting an error about CGI missing on your system before that? Also try use CGI qw/param/ just as a quick check.
I was going to ask about the missing Content-Type header too. You might as well add that from the example code.
Could we maybe go back a few steps.
Could you add a code to this script that gets the word from the location. Say the location is test.cgi?test=hello. THe script would fetch the word and put it into the script instead of the word "location".
param works with POST forms; to use GET, which encodes the parameter in the URI, use url_param
You seem to have replaced "#!/usr/bin/perl -w" with "-s" at some point, apparently by mistake. I took out the -s and added use warnings instead.
Other than that, I added a use CGI qw/url_param/ and the call to url_param, and put it in $location, so the template now says "Word from $location".
#!/usr/local/bin/perl
use CGI qw/url_param/;
use CGI::Carp qw/fatalsToBrowser/;
use strict;
use warnings;
my $location=url_param("test");
print "Content-type: text/html\n\n" ;
print <<EOF ;
<html>
<head><title>Test</title></head>
<body>
<h1>Word from $location</h1>
</body>
</html>
EOF
exit ;
Thanks, that worked grate!
But when I put in
it only shows in the page source. Do I have to do something special to have the script include information?
That's a server-side include, the server should be configured to expand that for you.
i.c..
Do I have to get the hosting company to do that for me?
Probably. I was sort of under the impression that the script you started out with was somehow working already, and you wanted to change it.
No, but the script you created for me does what I want it to do. But the <!--#include virtual--> only loads in the pages source. I got this reply when I asked my host to help me with server-side include (I showed them the script and told them what I intended to do):
Still it will not load the SSI. Was this not what I needed to get this to work?
Nope, SSI is unrelated to anything Perl. They might not even be offering it for all I know. Ask.
Here's Dreamhost's SSI page, for example: "SSI: Server-Side Includes" - DreamHost Knowledge Base
You're probably not on Dreamhost (and some of the stuff there does not apply at other providers), but look for something similar on your provider's pages.
Using a CGI to conditionally serve up another CGI via SSI seems slightly odd, but what do I know, I'm no web jockey.
If I had a Shell account, would this be something I could do myself?
Web hosting firms typically like to manage that sort of thing centrally; if they offer it then it's sure to be mentioned in their advertising (possibly with an extra price tag). I don't think a shell account would help at all, but again, check with your hosting provider.
ok, i.c.
What should I be looking for in an ad to know that a company provides this?
The Support center where I host asked:
Any idea what I should tell them?
Good question. You could say you want what Dreamhost offers and see how they react. Sounds like a small shop who might be willing to tweak their system in order to keep you as a customer. Also sounds like they don't have any SSI facility at all at the moment, otherwise they'd just point you to its documentation.
This is all a bit mysterious; I have a nagging doubt that you will tell us in the end that the reason you want this for i X and we'd all jump and shout and point you to the web site where you can get that.