in reply to Re^2: CGI "control panel" app
in thread CGI "control panel" app

I think what you want to do is this:

Create a CGI wrapper script around your "not a CGI script" script. Inside the wrapper, invoke the regular script using system(), or back ticks:

$status = `not_a_cgi.pl`;

Note that this is normally considered a bad idea (security risk, etc) - BUT, if you're only running on localhost, and no one else has access to your machine, and you have some way to guarantee that only you can see the control panel page (maybe a login page?) etc., etc. then it might be okay for what you want to do.

BUT - keep in mind that the script will run with the user id of the web server. For example, if you're running Apache it usually runs as user "apache", so any files you need to access from within your script must be readable/writable by "apache".

If this causes problems, you can modify the apache config file so that CGI scripts in your own CGI bin directory run with your user id instead (again, this is usually considered a bad idea, security risk, etc.) but may be okay for what you want.

I've done stuff like this before, but always within a company intranet, behind a firewall, for internal tools, used only by myself, etc. I'd never recommend something like this out in the wild.

Replies are listed 'Best First'.
Re^4: CGI "control panel" app
by mojodaddy (Pilgrim) on Jul 25, 2007 at 02:06 UTC
    "if you're only running on localhost, and no one else has access to your machine"

    Someone could break into the house and swipe my laptop, but if that happens I've got other problems. Plus, they'd have to pick a time when I'm not hunched over it, which is rare! : )

    I think what you've suggested will work nicely for me, assuming I sort out any permissions issues with Apache. Thanks!