Monkeypatching rears its ugly baboon head. :-)

Unfortunately copas and socket.http are order-dependent, you have to load
copas first. I added a check to copas.lua (at github) to warn you when this
is not the case so you can correct your code.

--
Fabio Mascarenhas


On Tue, Dec 1, 2009 at 1:36 PM, Alexander Gladysh <aglad...@gmail.com>wrote:

> Hi, list!
>
> It seems that copas breaks socket.protect() around http.request if
> copas is required before socket.http.
>
> $ cat >connect.lua
> local copas = require 'copas'
> local http = require 'socket.http'
> local res, err = http.request('http://127.0.0.1:50000/')
> print("NOT CRASHED", res, err)
>
> $ lua -l luarocks.require connect.lua # It works
> NOT CRASHED     nil     connection refused
>
> $ cat >connect2.lua
> local http = require 'socket.http' -- Note order
> local copas = require 'copas'
> local res, err = http.request('http://127.0.0.1:50000/')
> print("NOT CRASHED", res, err)
>
> $ lua -l luarocks.require connect2.lua # Now it is broken
> lua: connection refused
> stack traceback:
>        [C]: in function 'request'
>        connect2.lua:3: in main chunk
>        [C]: ?
>
> Alexander.
>
> P.S.
>
> $ uname -a
> Linux agladysh-desktop 2.6.31-15-generic #50-Ubuntu SMP Tue Nov 10
> 14:53:52 UTC 2009 x86_64 GNU/Linux
>
> $ lsb_release -a
> No LSB modules are available.
> Distributor ID: Ubuntu
> Description:    Ubuntu 9.10
> Release:        9.10
> Codename:       karmic
>
> $ lua -v
> Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
>
> $ luarocks --version
> luarocks 2.0.1
> LuaRocks main command-line interface
>
> $ luarocks list
> Failed loading manifest for /home/agladysh/.luarocks/lib/luarocks/rocks
>
> Installed rocks:
> ----------------
>
> copas
>   1.1.5-1 (installed) - /usr/local/lib/luarocks/rocks
>
> coxpcall
>   1.13.0-1 (installed) - /usr/local/lib/luarocks/rocks
>
> luafilesystem
>   1.5.0-1 (installed) - /usr/local/lib/luarocks/rocks
>
> luaposix
>   5.1.2-1 (installed) - /usr/local/lib/luarocks/rocks
>
> luasocket
>   2.0.2-2 (installed) - /usr/local/lib/luarocks/rocks
>
> rings
>   1.2.3-1 (installed) - /usr/local/lib/luarocks/rocks
>
> wsapi
>   cvs-3 (installed) - /usr/local/lib/luarocks/rocks
>
> wsapi-fcgi
>   cvs-2 (installed) - /usr/local/lib/luarocks/rocks
>
> xavante
>   2.1.0-1 (installed) - /usr/local/lib/luarocks/rocks
>
> _______________________________________________
> Kepler-Project mailing list
> Kepler-Project@lists.luaforge.net
> http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project
> http://www.keplerproject.org/
>
_______________________________________________
Kepler-Project mailing list
Kepler-Project@lists.luaforge.net
http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project
http://www.keplerproject.org/

Reply via email to