Reputation: 1875
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 !
Upvotes: 0
Views: 595
Reputation: 46245
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:
use a native desktop GUI to control the Perl without getting HTML or browsers involved at all or
install a mini HTTP server on the client to interact with the Perl code instead of having the browser run Perl directly
Upvotes: 2
Reputation: 31685
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.
Upvotes: 1