in reply to (OT) Regarding CGI script location
Your question had two parts -- neither of which is particularly a Perl question, but the second one at least a programming question. (For the first part, you'll want to take a look at your webserver's documentation. For dealing with security, you might want to take a look at suExec for apache, or cgiwrap for any other server.
Now -- for graphing -- I don't know exactly what you're trying to do, but overwriting the same file over and over again based on the input from the user just seems to be asking for trouble. If you have users A & B asking for the same page, but with different input, at almost the same time, it's possible that one of them will be given the wrong image. You also have to make sure to send the necessary cache-control headers in case the user tries revisiting the page with new parameters.
Instead, I see two main options:
Generate the images as they are requested. Images don't need to be static files ... they can be generated from CGIs as well. So, as you take the parameters from the user, you can then pass the relevent ones onto the image generating CGI, either through the QUERY_STRING, or PATH_INFO:
<img src='/cgi-bin/script?param=value;param2=value2' alt='whatever' height='x' width='y'>The whole page will take a little longer to load, as you don't start generating the image 'till the image is requested, rather than the page being requested, but I find it to be easier to maintain, as you don't need to worry about temp directories. If you're worried about other people making use of the image generating routine, you can add some sort of checksum to the parameters passed in, so it's less likely that someone will bypass the first page.
Note -- I've made a possibly incorrect assumption that the images vary with the parameters passed in and some sort of internal state, and that each image generated is most likely to be unique, or at the very least repeat so infrequently as to be not worthwhile to cache. If this isn't the case, you'll need to provide more details about what you're trying to do.
|
|---|