Using references from the shell?

Chandrashekhar Mullaparthi <>
Wed Aug 20 16:14:31 CEST 2003


Hi,

I dont think you can create a reference manually. But if you want to see the
contents of a reference, you can do term_to_binary(Ref) to see what it
contains. 

Erlang (BEAM) emulator version 5.2 [threads:0]

Eshell V5.2  (abort with ^G)
1> 
1> 
1> term_to_binary(make_ref()).
<<131,114,0,3,100,0,13,110,111,110,111,100,101,64,110,111,104,111,115,116,0,
0,0,
0,111,0,0,0,0,...>>
2> 
2> 
2> io:format("~p~n", [v(-1)]).
<<131,114,0,3,100,0,13,110,111,110,111,100,101,64,110,111,104,111,115,116,0,
0,0,
0,111,0,0,0,0,0,0,0,0>>
ok
3> 

cheers
Chandru

> -----Original Message-----
> From: Massimo Cesaro [mailto:]
> Sent: 20 August 2003 08:09
> To: 
> Subject: Using references from the shell?
> 
> 
> Hi,
> this is my first post on this list, but we studying/learning/using
> Erlang since June. 
> We are developing a softswitch application using Erlang and OTP and me
> and my team are really amazed of what we can accomplish using this
> wonderful middleware in record time. 
> Several of modules in the application have functions taking references
> (created with make_ref()) as parameters. I'd like to test those
> functions manually, using the Erlang shell, but the shell parser balks
> when I try to input a reference by hand. I.e.
> 
> 153> otr:connect(Source, Dest, #Ref<0.0.0.4363>, bridge).
> ** 1: syntax error before: Ref **
> 
> I tried several variations on the theme, with the same result.
> 
> In this case, the reference value I'm using was generated 
> internally by
> another module (using make_ref()), and stored in an ets 
> table. I should
> check for reference value equality.
> I understand that what I see in the shell is just  a 
> "rendering" of the
> real reference (I read a former thread in this list about the real
> format of references, courtesy of Rickard Green).
> The question is, can I handle references from the shell, or am I
> supposed to write a test module and pass references as opaque values?
> 
> Thanks,
> Massimo Cesaro - Eidetix
> 
> 



 NOTICE AND DISCLAIMER:
This email (including attachments) is confidential.  If you have received
this email in error please notify the sender immediately and delete this
email from your system without copying or disseminating it or placing any
reliance upon its contents.  We cannot accept liability for any breaches of
confidence arising through use of email.  Any opinions expressed in this
email (including attachments) are those of the author and do not necessarily
reflect our opinions.  We will not accept responsibility for any commitments
made by our employees outside the scope of our business.  We do not warrant
the accuracy or completeness of such information.




More information about the erlang-questions mailing list