If you can write and use a dedicated mod_perl handler, do it. It has the best performance of all.
Second choice should be a CGI script running under the "registry"-handler. The performance is still good, but you must take care in writing the CGI-script as there can be --as certainly you know-- some issues with repeatedly executing such scripts.
If none of the above is possible: use a classic CGI-approach.
CountZero
"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law