calling timer_interval from module
Wes James
comptekki@REDACTED
Fri Apr 30 19:57:02 CEST 2010
If I have:
-module('gpc').
-export([start/0]).
start() ->
%{ok,R}=
timer:apply_interval(3000, gpc, getc, []).
getc() -> "yep".
when I run:
gpc:start().
I get the error:
=ERROR REPORT==== 30-Apr-2010::11:39:15 ===
Error in process <0.70.0> with exit value: {undef,[{gpc,getc,[]}]}
If I change -export to:
-export([start/0, getc/0]).
If I run:
{ok,R}=timer:apply_interval(3000, gpc, getc, []).
I get
{ok,{interval,#Ref<0.0.0.461>}}
but nothing ever happens.
If I do the same thing with:
-module(tst).
-export([tst_fun/0]).
tst_fun() ->
io:format("~n~w~n", [erlang:localtime()]).
tst:tst_fun().
It works??
Any idea why the first doesn't work?
The difference is running timer:apply_interval from the cli vs from
inside a module, it looks like.
thx,
-wes
More information about the erlang-questions
mailing list