I have written a perl script which opens an shtml document and reads it into an array (@htmldoc). It then substitutes a number of placeholders with variables which have been passed to the script from the link and then prints out @htmldoc.

One of the variables passed to the script is $course_desc which in this example represents the value 243desc.txt. The placeholder %%course_desc%% is being substituted with the variable $course_desc.

The shtml document before being read into the perl script has the following line:

 <!--#include virtual="/crs_desc/%%course_desc%%"/ -->

The problem I ran into is that when perl prints out @htmldoc, it does not parse the ssi command. When you view the html code printed by the perl script it shows the following line:

 <!--#include virtual="/crs_desc/243desc.text"/ -->

It interpretes the statement as if it was an html comment, so it doesn't print anything.

I have a variety of external documents which I need to import into the html template, depending on the value of the $course_desc variable. Is there a way to get SSI to work with perl, OR, is there another way of creating the dynamic content using external documents besides using SSI?

I have tried SSI enabling both the cgi-bin directory and the shtml document directory and that doesn't work. I know its not an SSI configuration problem.

Thanks in advance. Chris


In reply to Perl and SSI by chriso

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.