Perl Monk, Perl Meditation | |
PerlMonks |
Re: Javascript and Perl... a match never made.by gryphon (Abbot) |
on Jul 19, 2002 at 19:53 UTC ( [id://183421]=note: print w/replies, xml ) | Need Help?? |
Greetings anonymous, Several Web browsers are setup to expect that all JavaScript files included via the <SCRIPT SRC=""> tag have the ".js" extention. I ran into this problem about a year ago when I was trying to do something fairly similar. I just changed my file extention of the CGI from ".cgi" to ".js", and things worked perfectly. Of course, you may have to mess around with an .htaccess file somewhere to get the desired result. Dealing with the GET CGI parameters is a little tricky. You could try putting them into the URL. For example, try:
In this case, there's an enviornment variable created (usually) called "PATH_INFO". It'll be equal to "/script=somescript/file.js" in this case. So now just regex the "somescript" out of that and you're done. my $script_name = $1 if ($ENV{PATH_INFO} =~ m|/script=([^/]+)/|);-gryphon
In Section
Seekers of Perl Wisdom
|
|