There ARE ways to call a program from an html page, but not if you want it to return a value to the place it was called from. If all you want to do is call the program to update some stats, for instance, use an IMG tag, and have your program return a 1x1 pixel transparent gif when it is done (with the appropriate content type header). Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
there's no built in way to do what you want, but it should be really easy for you to make a script that reads in the query string and then executes a subroutine named by it. just have a couple conditionals:[tt]
if ($query_string =~ m/function1/) {&function1();}
elsif ($query_string =~ m/fuction2/) {&function2();}
etc...[/tt]
you could even do autoloading stuff, but i doubt you need something that sophisticated. is this what you're looking for? "If you think you're too small to make a difference, try spending a night in a closed tent with a mosquito."
well, actually... I'd want to use it for forms...
I have a script that uses a lot of forms... and I was thinking that It would be handy if I could "submit" a form to a subroutine of a script... It would certainly be easier than submitting all the forms to the same script...
something like <form action=&subA methode=POST>
It would also mean that the script doesn't have to be completely reloaded everytime a form is submitted...
well, you can always add:[tt]
<INPUT TYPE="hidden" NAME="subroutine" VALUE="fuction1">
[/tt]to your forms, then check that paramater first off in the script. there's no built in way to, from a page, call a specific function from a perl script. you have to build that yourself. "If you think you're too small to make a difference, try spending a night in a closed tent with a mosquito."
If all the subroutines are in the same source code file, it's going to reload the whole script anyway. You can try breaking it into separate source code files, and using a separate form for each subroutine you want to call. Or you can use an onSubmit function to determine which subroutine you want to call and submit the form to the appropriate program yourself. Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.