This is more a function of your webserver, than of CGI or Perl. Webservers by default just act as a switchboard, and can optionally hand off to CGI, ColdFusion, PHP, SSIs, or whatever other text-preprocessor you might have. It is exceedingly difficult to have one preprocessor hand off to another one. Generating a seperate page, and then redirecting to it is one way to get the webserver to use a diffferent interpreter for each step of the process, but if that is out, for whatever reason, it's possible that there might be another way --

Apache uses a series of handlers, and it might be possible, using mod_perl to adjust the stack. (I don't know if it can be done dynamically, as I've never tried, but I have that general impression after having read Practical mod_perl.). It may be easier with Apache 2, as there are specifically SetInputFilter and SetOutputFilter rather than just SetHandler. If you set mod_perl as the input filter, the webserver may still do its general switchboarding to pass off to another program.

Another alternative would be to call the other language's engine from within your script, but this would probably ruin any optimizations they might have, and would only be possible with those parsers that can be called from the command line (like PHP), or to have the script use LWP or similar to call the webserver to get the templates that have already been parsed. (you may have to change the order of operations, to have whatever the alternative preprocessor is, to call the script through the webserver, so it executes last, but this could be messy, and need extra files)

Update: Practical mod_perl is available online, under the creative commons license.


In reply to Re: How do I present other web extensions? by jhourcle
in thread How do I present other web extensions? by astroboy

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.