You can also do this from scratch without using CPAN modules. I tested this on Linux (Ubuntu 16.04, Google Chrome version 53) using Unix Domain (UD) Sockets. Unfortunately, it seems that Windows does not have UD sockets, but this should be possible to do from Windows using named pipes.
First make sure google-chrome running in the background. We will need to create a Chrome application that will communicate with its own host through the built-in messaging API . native host can be any script that reads messages from STDIN and returns responses via STDOUT . I tested both Python script and Perl script.
Now, so that the stand-alone Perl script can communicate with the Chrome Browser, it will send the request through the UD socket (created by the native host) to its own host; the internal host will then forward the request to google-chrome through its standard output pipe. Then the Chrome application (written in JavaScript) will receive the request. The Chrome application will use the Chrome JavaScript API to retrieve the requested data and return it to the host. Finally, the native host redirects the result through the Perl script socket.
As you can see, there are some details needed to configure this, but I can confirm that it works on my Linux platform. Please let me know if you need more details.
Håkon Hægland
source share