jerrygarciuh has asked for the wisdom of the Perl Monks concerning the following question:

I have been neck deep in in the Llama, the Rat, and several forums trying to discover where to start this project. I have altered the MSA Simple Search script to put out some fancy HTML with the results and it works well. Now the client would like the HTML to appear under his massive collection of javascript rollover links and other garbage. Where do I begin to learn to fuse files? I assume there are 1 or more .pm or -lib files involved but my books are unclear. TIA jg
  • Comment on Append script output to complex block of html and script

Replies are listed 'Best First'.
Re: Append script output to complex block of html and script
by monkfish (Pilgrim) on Sep 07, 2001 at 07:17 UTC
    Perhaps you could supply some code to make the problem a little more clear.

    With out knowing more, I'll take a stab in the dark and suggest a serverside include in the client's pages of your script.

    Good luck and give us some more details so we can help...

    -monkfish

      Well, the jist of it is that the script currently spits out a whole page which it writes from scratch. I need to alter the script so it opens a file of 30 lines of html and appends the script output onto it. Like a search engine does, the logo is there, the links are there, and my on-the-fly code sits underneath. I don't expect anyone to write this I just can't seem to find an answer in my books. I am clearly not asking this in a way which makes perlsense.
        The code below does as you ask. It opens an existing html file, prints it and then runs your script.

        use strict; use warnings; open(FH,"<./test.html") || die "couldn't open file $!\n"; my @html=<FH>; close(FH); print @html; print " my script stuff<P>\n"; print '</body>';
        As monkfish suggests a server side include may also do what you want.

        You would put the following line inside your html document

        <!--#exec cgi="/cgi-bin/yourscript.pl" -->

        Some random personal SSI thoughts:

        1. Microsoft IIS is more forgiving of syntax sloppiness. For example you can have a space between the -- and the # This can cause problems when you switch to apache.

        2. Your server has to have SSI enabled and has to allow exec commands. Allowing any user to execute any command in their page is considered a security risk.

        3. As far as I know, there is not a portable way to pass your CGI parameters. Apache supports environment variables. IIS supports a parameter string but not vice versa

        Hope this helps


        --mandog