How to get rid of this badarg error

MEENA SELVAM meena_selvam@REDACTED
Wed Sep 21 20:29:57 CEST 2005


I have some code as follows:

1    {CookieInt, _} = string:to_integer(CookieStr),
 2   io:format("[CookieInt] = ~p~n", [CookieInt]),
  3  [CacheEntry] = ets:lookup(aaa_cache,CookieInt),

where CookieInt is printed as 15063539827397697793
I get an error at Line 3 as follows

Unrecognised error:
{badarg,[{ets,lookup,[aaa_cache,15063539827397697793]},
                          
{ssl_xnet_cmd,'-user_kick/2-fun-0-',1},
                             {lists,foreach,2},
...
...

Where as when I type [CacheEntry] =
ets:lookup(aaa_cache, 15063539827397697793).
at the erlang shell it fetches the record correctly
from the aaa_cache table, where
15063539827397697793 is the key.

So what is CookieInt at line 1. Is it an atom or
variable. I supposed it was a variable and hence used
it line 3. But I do not understand why it does not
work?

Any suggestions or comments to get out of this
problem?


PS; the CookieStr in line 1 was derived from these
code. I think, these may not be relevant to the
problem:

A=  binary_to_list(Cookie),
               io:format("[A] = ~p~n", [A]),     % A
is printed as ed5f793776732.15063539827397697793
               Index = string:chr(A,$.),
               CookieStr = string:substr(A, Index+1),
meena




		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com



More information about the erlang-questions mailing list