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.