Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
Server Side Includes

Posted by TedH (TedH), 13 February 2008
Hi, I'm trying something I have never done before (again) and so have ended up here.

Preamble
A script produces 3 items. A database record (FFDB), an HTML file and a small perl script.
The HTML has an SSI calling the small script.

The small script has variables defined when written and references another script with those variables, which in turn accesses the database and produces the correct output. All well and good.

I would like to not have the small script, but instead use an SSI to do the routine.

The small script looks similar to this:
Code:
require "c:/aaa/apache/cgi-bin/news/news.pl";
$datalist = "c:/aaa/apache/cgi-bin/news/data/200802.db";
$theid = "20080212171505";
&crentry;


Current SSI
Code:
<!--#include virtual="re_20080212171505.pl" -->


(The following are broken up by hand so's they'll fit on this page without side scroll)

THE SSI I tried out (several variation attempts, but this is as good as any as none of them worked):
Code:
<!--#include virtual="c:/aaa/apache/cgi-bin/news/news.pl?
$datalist=c:/aaa/apache/cgi-bin/news/data/200802.db
$theid=20080212171505 &crentry -->


Resulting Error:
Code:
[Wed Feb 13 00:13:10 2008] [error] [client 127.0.0.1] unable to include
"c:/aaa/apache/cgi-bin/news/news.pl?&crentry
$datalist=c:/aaa/apache/cgi-bin/news/data/200802.db
$theid=20080212171505 "
in parsed
file C:/aaa/apache/htdocs/news/archive/200802/20080212171505.html,
referer: http://localhost/index.html

 
I'm either barking up the wrong tree or (more likely) have gotten this wrong, 'cuz I don't know what I'm doing.

Ummm... help please

- Ted


Posted by admin (Graham Ellis), 13 February 2008
It says "unable to include" so I would look at file permissions, setting up of the server (does it allow SSIs), whether the Perl script has the correct #! line at the top of it, and so on.

Two questions / thoughts

a) Whilst things may work this way, it seems quite a convoluted approach to scripting and I wonder if there might be a more conventional way of doing whatever you're looking to achieve

b) Have you tried a step by step approach to getting the elemens of this such as SSI working - just trying a simple one line included file first to get that working in a test program, the building up until you have the whole thing running?

Posted by KevinAD (KevinAD), 13 February 2008
First do as Graham has suggested, start easy to make sure the SSI works. Although since you are getting an error back from the SSI call it is evident that the SSI tag is getting parsed and trying to do something, otherwise you would get nothing back at all. Lets look at your SSI tag:

<!--#include virtual="c:/aaa/apache/cgi-bin/news/news.pl?  
$datalist=c:/aaa/apache/cgi-bin/news/data/200802.db  
$theid=20080212171505 &crentry -->

If you expect that $datalist and  $theid are perl variables, then you are mistaken. Also you can not use a perl function in your SSI tag (&crentry). You are seemingly coding your SSI tag like it is a mini perl program, which of course will not work.

What you can do is pass the variables as query string data to the news.pl program and parse them out and use them int he news.pl script.

<!--#include virtual="c:/aaa/apache/cgi-bin/news/news.pl?datalist=200802  &theid=20080212171505&com=crentry" -->

If you are already familiar with how to parse out the query string data and get it into a perl program then you are ready to go.


Posted by TedH (TedH), 13 February 2008
Hi guys,

"seems quite a convoluted approach to scripting and I wonder if there might be a more conventional way of doing whatever you're looking to achieve "

There probably is Graham, I do kinda go at things weird

"You are seemingly coding your SSI tag like it is a mini perl program, which of course will not work. "

In a sense Kevin, that was what I had in mind. I reckoned if and SSI can run like a mini script then I wouldn't need the four liner.  

I'll do as suggested by both of you. I'm also trying to figure out the Apache manual page on SSI's, but that'll take some time as there's quite a lot of cross referencing to other stuff that I don't know about.

"query string data" - I'll read up on that too.

Thanks - Ted
-------
Graham - is it me or is the forum script acting up? When I've posted that last couple of times the preview didn't work - just went straight into the post without preview) and I'm not getting the usual email (after ticking the box)  - T

Posted by KevinAD (KevinAD), 13 February 2008
It is possible to get the query string data from the environment variables or using the CGI module. The CGI module would be safer unless you really know what you are doing, which it is clear you do not at this point, so I recommend you check out the CGI module to get the query string data into your perl program.

Posted by TedH (TedH), 14 February 2008
Okay thanks Kevin.

-------

Graham, got email sorted. I had an old domain that I just let go on the address, so changed it.



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2014: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho