Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Parsing SSI through CGI

by higle (Chaplain)
on Feb 01, 2002 at 16:12 UTC ( [id://142708]=perlquestion: print w/replies, xml ) Need Help??

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

'Morning, Everyone--

On my company's intranet, I've built a CGI script that accepts a product ID, uses it to query our product database, and generates a page dynamically to the browser. Simple enough...

...until the Powers That Be decided to redesign the intranet reference system. Now, they're wanting to use SSI (argh!) to include a newly designed navigation thingumy at the top of all the pages. The problem that I've run up against is trying to get my script to parse the HTML and execute the SSI directives before printing the page to the browser. My company is tight about installing new modules on our machines, so I can't use CGI::SSI, CGI::SSI_Parser, or Apache::SSI (we're running a Netscape webserver, too. Gurgle...).

It's starting out pretty simple now, only including one .shtml file in the dynamic output. I want to be prepared, however, to handle this monster if it gets any bigger, with SSI #exec directives or whatever. I'd hate to have to roll my own module, and I don't want to do it the clunky way, manually retrieving the included file, reading into a scalar, and printing it inline with the usual output.

Is there a simpler way of doing this, by either modifying the document header, or something? Or am I going to have to make my own module, or manually retrieve the file?

Thanks so much for any help!

------------------------
higle
perl -e 's=$;$/=$\;W=i;$\=$/;s;;XYW\\U$"\;\);sig,$_^=$[x5,print;'

Replies are listed 'Best First'.
Re: Parsing SSI through CGI
by dws (Chancellor) on Feb 01, 2002 at 17:33 UTC
    The problem that I've run up against is trying to get my script to parse the HTML and execute the SSI directives before printing the page to the browser.

    I ran up against this a few years ago. After failing to convince Netscape FastTrack to honor SSI directives my CGI was emitting in HTML, I wrote my own SSI package. You're welcome to whatever pieces of it work for you. The source is here.

    With FastTrack, I suspect the problem was that code paths through the web server didn't allow for SSI once a decision had been made to execute a CGI. We never did get to the bottom of it, and later moved on to Apache.

      Wow! Thanks! That looks like it should work. I'll give it a try.

      Thanks again

      ------------------------
      higle
      perl -e 's=$;$/=$\;W=i;$\=$/;s;;XYW\\U$"\;\);sig,$_^=$[x5,print;'
Re: Parsing SSI through CGI
by perrin (Chancellor) on Feb 01, 2002 at 23:33 UTC
      "My company is tight about installing new modules on our machines, so I can't use CGI::SSI, CGI::SSI_Parser, or Apache::SSI"

      Wasn't sure if you noticed that, perrin

      -- Yes, I am a criminal. My crime is that of defyance.
        You're right I didn't. However, it makes no difference. If this guy can take the code that dws wrote and put it on the server, he can do the same with a module from CPAN. He can just shove the whole module into his script if necessary.

        I think some people don't understand that there's nothing special about most CPAN modules: they're just a bunch of Perl code in a file. No fancy install is required.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://142708]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-19 21:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found