[erlang-questions] port program -- how to start it and use it?

Bengt Kleberg <>
Mon Sep 15 07:57:42 CEST 2008


Greetings,

Your last problem (returning the right thing) is the simplest:

Result = textstat:enum(ascii),
textstat:stop(),
Result.

As for your first problem, with things not having started yet, you have
to wait a while. Either until they have started (loop with a test if
things have started) or just wait a while (timer:sleep( 1000 )).


bengt

On Sun, 2008-09-14 at 11:30 -0700, Peter Smith wrote:
> I'm looking at the Erlang Interoperability Tutorial, and using it for
> my own little bit of interoperability -- and I Just Don't Get
> something:
> 
> 
> I can see the 'start' and 'foo' and 'bar' and 'stop' functions, and I
> even think I understand them.  What I want to do is make a "unit test"
> that does a start, calls some 'foo' and checks the results, and then
> calls 'stop'.  I've made a module that works with my own program
> (which was really quite simple -- certainly five times easier than
> Perl), and from the shell I can type in the commands 'start', 'foo',
> and 'stop' with no problem.
> 
> 
> But I can't make a unit test!  When I try this:
> 
> 
> g() ->
> textstat:start(),
> textstat:enum(ascii),
> textstat:stop().
> 
> 
> I just get an error as if from the 'enum' (my version of 'foo') that
> implies that the start hasn't actually finished starting yet.  And in
> any event, won't the return from 'g' really be the results of the
> 'stop' when I really want it to be the result of the 'enum(ascii)'?
> 
> 
> Thanks,
> Peter
> 
> 
> 
> 
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list