Further, how to find whether my server supports SSI or not?
to avoid generating entire html through perl, I have created an html
file of the header part that remains common across the perl script results.
I want to include it in my result and then add whatever perl generates
along with footer.
How to give that command in my perlscript?
I have added in my perlscript
print "<!--#include file=\"index_search_include.txt\"-->\n";
where index_search_include.txt is the header file that I have made.
but server is giving 500 internal server error and error logs are showing
malformed header from script. Bad header=<!--#include file="index_searc:
/home/username/public_html/cgi-bin/search.cgi
where to put that index_search_include.txt file? in cgi-bin or in
public_html or where, and what name to include? just the file name or
even the path /home/username/public_html/index_search_include.txt
If you generate, or get some portion of your html with perl, then pass
it on, you can do any sort of amalgomation you wan't.
It seams as though you are forcing the html through a processor that
won't take incomplete html.
You many need a perl script that joins html fragments into a whole
before sending it to the renderer.
You can do it one of two ways, insert the placeholder in the constant html
or insert it into the dynamic part, substitute, then send it to the renderer.
This avoids generating html because you are using constant html as the substitute,
and just printing out the joined parts. Since this is by design, there should be no
errors as long as the reconstituted whole does not have errors (which can be checked
before the renderer gets it).
This can be done by hand like mail merge substitution or you can use a reliable
capture parser (or do it all in ASP?):
=========================
use strict;
use warnings;
use RXParse; # VERSIN 2
my $p = new RXParse();
$p->setMode( 'html' => 1, 'resume_onerror'=> 1 );
$p->setHandlers('start' => \&starth, 'end' => \&endh);
sub starth
{
my ($obj, $el, $term, @attr) = @_;
my $buffer = lc($el);
if ($buffer eq 'substitutebody' || $buffer eq 'substitutefooter')
{
$obj->CaptureOn( $buffer );
}
}
sub endh
{
my ($obj, $el, $term) = @_;
my $buffer = lc($el);
if ($buffer eq 'substitutebody' || $buffer eq 'substitutefooter')
{
$obj->CaptureOff( $buffer, 1 );
}
}
open my $fh, 'c:\temp\header_footr.html' or die "can't open header_footr.html...";
$p->CaptureOn('ALL');
$p->parse($fh);
$p->CaptureOff('ALL');
close $fh;
$p->DumpCaptureBuffs();
# generate dynamic html
# ...
# substitute the capture sequence body for the dynamic html generated.
# the sequence is just the index into the main capture array.
# this is all 'raw' html. functions are provided for this though.
# ....
# write/send out the entire sequence now as complete html
# ...
__END__
BUFFER: all
=====================================
index seqence
----- --------
[0] 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""
http://www.w3.org/TR/html4/loose.dtd"><html lang="en"><head><title>CNN.com - Breaking News, U.S., World, Weather,
Entertainment & Video News</title>
<meta http-equiv="refresh" content="1800;url=?refresh=1">
<meta name="Description" content="CNN.com delivers the latest breaking news and information on the latest top stories, weather, business, entertainment, politics, and more. For in-depth coverage,
CNN.com provides special reports, video, audio, photo galleries, and interactive guides.">
<meta name="Keywords" content="CNN, CNN news, CNN.com, CNN TV, news, news online, breaking news, U.S. news, world news, weather, business, CNN Money, sports, politics, law, technology, entertainment,
education, travel, health, special reports, autos, developing story, news video, CNN Intl">
</head>
[1] -2
[2] 3 undefined
[3] -4
[4] 5 </html>
BUFFER: substitutebody
=====================================
index seqence
----- --------
[0] 2 <substitutebody DROP YOUR BODY IN THIS SEQUENCE></substitutebody>
BUFFER: substitutefooter
=====================================
index seqence
----- --------
[0] 4 <substitutefooter DROP YOUR FOOTER IN THIS SEQUENCE></substitutefooter>