Hello,
thanks for the suggestion Torbjörn, I had not yet the time to test it
but it seems promising (I am mostly an Emacs user also). It's on my
todo list now.
I found the cause of the problem. When debugging using Erlang's
debugger, he considers the Length variable used in the second case
statement (attribution to #att.len) to be already bound. This is so
because the previous case statement also uses a variable named Length
in 2 of its branches.
Just renaming the second one from Length to Length2
(chouch_httpd_db.erl line 1045) avoids the badmatch error:
[#att{
name = FileName,
type = case couch_httpd:header_value(Req,"Content-Type") of
undefined ->
% We could throw an error here or guess by the FileName.
% Currently, just giving it a default.
<<"application/octet-stream">>;
CType ->
list_to_binary(CType)
end,
data = case couch_httpd:body_length(Req) of
undefined ->
<<"">>;
{unknown_transfer_encoding, Unknown} ->
exit({unknown_transfer_encoding, Unknown});
chunked ->
fun(MaxChunkSize, ChunkFun, InitState) ->
couch_httpd:recv_chunked(Req, MaxChunkSize,
ChunkFun, InitState)
end;
0 ->
<<"">>;
Length when is_integer(Length) ->
fun() -> couch_httpd:recv(Req, 0) end;
Length ->
exit({length_not_integer, Length})
end,
len = case couch_httpd:header_value(Req,"Content-Length") of
undefined ->
undefined;
Length2 ->
list_to_integer(Length2)
end
}]
end,
I wonder why this badmatch error only occurs when interpreting the
code with the debugger and not during normal execution.
Anyone has a clue?
cheers
2009/12/2 Torbjörn Törnkvist <[email protected]>:
> For some more light weight debugging I can recomend redbug. It is included
> in the eper repo at google code.
>
> --Tobbe
>
> Den 12 1, 2009 11:50 PM, "Robert Dionne" <[email protected]>
> skrev:
>
> I've had great luck using Distel[1] on top of aquamacs. Bill Clementson
> wrote a couple of nice how to pieces[2] to get you started. Works like a
> champ
>
> [1] http://github.com/bdionne/distel
> [2] http://bc.tech.coop/blog/070528.html
>
> On Dec 1, 2009, at 5:34 PM, Filipe David Manana wrote: > Hello, > > I am
> having a strange sit...
>
--
Filipe David Manana,
[email protected]
PGP key - http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xC569452B
"Reasonable men adapt themselves to the world.
Unreasonable men adapt the world to themselves.
That's why all progress depends on unreasonable men."