Using references from the shell?

Massimo Cesaro massimo.cesaro@REDACTED
Wed Aug 20 17:59:22 CEST 2003


On Wed, 2003-08-20 at 16:27, Pierpaolo BERNARDI wrote:
> From: "Massimo Cesaro" <massimo.cesaro@REDACTED>
> 
> > 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?
> 
> As far as I understand, the whole point of references is that they are
> unforgeable.  If there existed a way to obtain the reference from
> its printed representation then this would be vanified.
I (naively?) thought that references are really for creating unique
values even on a distributed system. I never thought to them as
unforgeable values.
Anyway, I found a workaround for testing my modules from the shell. The
trick is in using a shell variable to hold the reference value:
62>
Ref=otr_switch:get_call_id(otr_switch:resolve("aaln/1@[192.168.0.16]",
"555", [])).
#Ref<0.0.0.1637>

Now the Rf variable holds the value of the make_ref()'ed call id
returned by otr_switch:resolve/3. otr_switch:get_call_id/1 is just a
helper that extracts the reference from a list.

Then I can use the reference like this:

63>otr_switch:connection("aaln/1@[192.168.0.16]",
"aaln/2@[192.168.0.16]",Ref,bridge).
true

> 
> Perhaps you can do: 
> 
>      R = ets:lookup(...), func(R).
> 
> ??
> 
> Ciao
> P.
> 
Thanks for the info,
Massimo




More information about the erlang-questions mailing list