mozrepl

can we exit without error from telnet with MozRepl?

天涯浪子 提交于 2020-01-06 15:51:09
问题 based on this answer, I am trying to figure out a way to exit from telnet and it return 0 these wont work: (echo -e "repl.quit()";sleep 1) |telnet localhost 4242;echo $? (echo -e "\029";sleep 1;echo "q";sleep 1) |telnet localhost 4242;echo $? (echo -e "\c]";sleep 1;echo "q";sleep 1) |telnet localhost 4242;echo $? (echo -e "\e]";sleep 1;echo "q";sleep 1) |telnet localhost 4242;echo $? (echo -e "\E]";sleep 1;echo "q";sleep 1) |telnet localhost 4242;echo $? The problem is: I am UNABLE to

Simplest way to launch Firefox, drive 3rd party site using privileged nsI* APIs

时光毁灭记忆、已成空白 提交于 2019-12-12 08:16:30
问题 What's the simplest way to launch Firefox, load a 3rd party website (which I'm authorised to "automate"), and run some "privileged" APIs against that site? (e.g: nsIProgressListener, nsIWindowMediator, etc). I've tried a two approaches: Create a tabbed browser using XULrunner, "plumbing" all the appropriate APIs required for the 3rd party site to open new windows, follow 302 redirects, etc. Doing it this way, it's an aweful lot of code, and requires (afaict) that the user installs the app, or

Perl - Breaking a variable from the input into two for the url

孤者浪人 提交于 2019-12-11 07:17:17
问题 I'm loading data from a .txt for the purposes of scraping. However, the URL requires that I break that variable up and do +/- 2 to it. For example, if the value is 2342, I need to create 2340 and 2344 for the purposes of the URL. I took a guess at how to break it up: $args{birth_year} = ($args{birth_year} - 2) . '-' . ($args{birth_year} + 2); How do I then put it in the URL? Here's the relevant part of the code: use strict; use warnings; use WWW::Mechanize::Firefox; use Data::Dumper; use LWP:

How can i use Unicode string key In Javascript Object?

╄→尐↘猪︶ㄣ 提交于 2019-12-08 17:06:28
问题 I want to use unicode string in Object as key, something as: var t = {"姓名": "naitong"}; it's ok , t["姓名"] return "naitong" but Object.keys({"姓名": "naitong"}) I got " ", a blank string Anyone knowes why? Editting: I install firebug and try it in the console, it works. Acctually i use mozrepl, so that i can editing and run javascript in emacs. So This have something to do with mozrepl I have confirm that mozrepl support only "7bit safe ASCII", to tranform unicode ,i have to json-encode it in