Is there anyway to invoke a Perl CGI script when an HTML page is requested to server?
Just like a script can be tied to an action, is there anyway to tie a script to "Request for page"
feedback
|
This question came from our site for professional and enthusiast programmers.
|
Whether a Perl CGI program gets invoked or not depends primarily on the server configuration and the "path" part of the resource path. The Perl CGI script might return HTML (and usually this is the case). So requesting a script is often effectively requesting an html page, even if the URL doesn't contain ".html". If the URL is, say, http://www.example.com/cgi-bin/myscript.html I suspect that most web servers would try to see if myscript.html is a runnable program or script of some sort. See also http://httpd.apache.org/docs/2.0/howto/cgi.html especially "CGI outside of ScriptAlias directories" To silently change /some/path/foo.html to /other/path/bar.cgi see http://httpd.apache.org/docs/2.0/misc/rewriteguide.html | |||||
feedback
|
Yes. There are several possible ways, depending on what you wish to achieve.
Example: you are trying to execute
| |||
|
feedback
|
|
I'm assuming that you want to serve a plain HTML file and have some Perl CGI script fire-off in the background. A bit old fashioned but you could use an SSI like Can do something similar in JavaScript (probably with | |||
|
feedback
|