Chuma has asked for the wisdom of the Perl Monks concerning the following question:
Dear monks,
I have an HTML file showing a table, and I'd like to be able to edit parts of it. Naturally, you can't edit the table directly in the browser, so I figure I'll click a table cell and have Javascript pop up an input box, then pass that data to a Perl script which updates the underlying data file and the HTML. I could do that using CGI, but that seems like a strange way of doing it – I'm not going to put this functionality online, so why involve a server when all I want to do is edit my own files? But of course you can't run a local Perl script from a webpage, since that would be a security problem. So I'm trying to figure out a way to make Perl react to what's going on in the webpage.
So far my best idea is:
- have my Perl program running in the background
- on clicking a table cell, ask for user input with Javascript
- put that input plus a cell reference in an invisible text field
- copy that text to clipboard
- let the Perl script listen for changes to the clipboard, and use that to update the data files
Can you think of a solution that's less ridiculous?