0

Iam a bit new to java script and would like to know if there is any way to call a perl script when a button is clicked from a HTML web page without the intervention of the server(Tomcat,XAMP,etc.).One important thing is that the existing perl code can't be modified. In case if any perl module would do the trick let me know about it.My working platform is Linux. Thank you !

2
  • See bytes.com/topic/javascript/answers/… Commented Mar 16, 2013 at 9:50
  • Thanx for the reply!But even that code needs a server.you can see at the bottom of the post with the url "cgi-bin..." Commented Mar 16, 2013 at 10:24

2 Answers 2

2

In the general case, no, that is not possible.

If the code is to run on the client, then the client needs to download it from the server and then execute it. It would also require a browser plugin which allows the execution of Perl code in the browser, since that's not a standard browser capability; while I believe that such plugins do exist, they're not in widespread use.

If the code is to run on the server, then the server is clearly already involved.

The only way I can see it being possible to run Perl code from an HTML page without involving a server would be to install the Perl code, the calling page, and a Perl browser plugin on the client in advance. This would be a sufficiently esoteric arrangement that I don't see much point in pursuing it unless you need to do this on a machine with no network connectivity - and even then, it would probably be easier and more straightforward to either:

  1. use a native desktop GUI to control the Perl without getting HTML or browsers involved at all or

  2. install a mini HTTP server on the client to interact with the Perl code instead of having the browser run Perl directly

Sign up to request clarification or add additional context in comments.

Comments

1

If the Perl script should run on the client: this cannot be done.

If the Perl script should run on the server: wrap the button into a form that has the URL of the Perl script as action-attribute.

6 Comments

OP already says he doesn't want to use a server. While what you're saying is indeed correct, it's better put as a comment, as it doesn't answer the question.
It not only answers the question. It also provides an answer for the case that OP wants to change his mind and use a server after all.
Already tried that but it is actually is downloading the perl code.
Then your web server is configured not to execute Perl code. Change the webserver configuration such that it executes perl code.
Can you please suggest me how to do that. Any links are welcome.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.