My fellow monks,

My instincts say that I should be able to do what I want, but I'm new enough to mod_perl that I don't see how to do it.

Basic issue: I'm upgrading a website that uses a bunch of external (vendor-ish) CGI scripts (cvsweb.cgi being one example). There are two primary goals for this upgrade:

  1. Remove the umpteen bazillion .htaccess files that are used in multiple places, consolidating all of the authentication in a single place. An adjunct to this is to build a login mechanism from the home page, etc.
  2. Provide consistent headers / footers for all pages, some of which is dynamic-ish content.
I've already converted all of "our" stuff over to mod_perl and am using HTML::Template for all dynamic bits. My trouble comes in when I get to trying to deal with the external CGI scripts because they all want to think they "own" the entire screen.

Simply putting all of these external CGIs under mod_perl isn't sufficient because I then lose the consistent header/footer as well as the ability to (outside of .htaccess) control access to these pages.

My gut says that I should be able to have all of the requests that would (normally) go to a CGI pointed through a portal-ish mod_perl routine. This portal would, in theory at least, take care of the access controls / restrictions as well as then "proxying" for the underlying CGI scripts.

Following this train of thought, I should (somehow) be able to construct the proper internal (to Apache) CGI call, including knitting the authentication info to show that I've got an authenticated user, and then intercept the results of the CGI and insert that into my pre-fabricated display structure.

My problem is... Given that I can grab any arbitrary URL (Yes, I have complete control over this server), how can I inject myself into the CGI process so that I, and not Apache, own the call to the CGI?

Any / all thoughts and suggestions from anyone who's done anything remotely like this (or knows enough mod_perl to point me in the right direction) would be greatly appreciated.


In reply to Embedding "user" CGI output into a mod_perl response by bmcatt

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.