Can SSI just die, please? They're awful. They're older than CGI, if you can imagine that.

If you're pressed for time, you can use here documents with limited string interpolation. If you're dealing with non-technical types, you can use a simple templating system such as Text::Template. Or, if you're in the middle, you could consider using something like PHP, though that is really a last resort.

What I would do is try and develop a system that can do these insertions for you without the overhead of SSI. It's not terribly difficult. Apache::Filter can be handy for this kind of work, as it feeds you the file that is being processed, and you can modify it accordingly before sending it to the browser.

I know this sounds bitter and cynical, but a mod_perl handler is so easy to write if you have the right reference. Writing Apache Modules in Perl and C is one such book. All you have to do, in the end, is write a suitable handler function, which at it's most basic is this:
package MyHandler; use Apache::Constants qw[ :standard ]; sub handler { my ($r) = @_; # Apache Request Object do_some_stuff(); # Your function(s) print "Some stuff\n"; # Your output return OK; }
What you do in there is entirely up to you. In some cases, it's even easier than CGI. There are examples in the book for inserting a header/footer combination on a directory of HTML files. These can be adapted to do things such as insert a bit of text on a tag.

Since it's all Perl, you can link in any code you need to your handler and let it rip from there. As you'd expect, it can be pretty fast.

In reply to Re: Does mod_perl work when used as an include? by tadman
in thread Does mod_perl work when used as an include? by Anonymous Monk

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.