문제

Is there a way to use records directly in erl? No matter what I try, it always says it canno find the record. I am trying to do mnesia transactions and I cannot go too far without my records. Any help is greatly appreciated - thank you!

도움이 되었습니까?

해결책

Yes, use help() and find these commands in the shell.

rd(R,D)    -- define a record
rf()       -- remove all record information
rf(R)      -- remove record information about R
rl()       -- display all record information
rl(R)      -- display record information about R
rp(Term)   -- display Term using the shell's record information
rr(File)   -- read record information from File (wildcards allowed)
rr(F,R)    -- read selected record information from file(s)
rr(F,R,O)  -- read selected record information with options

These are a clever hack in the shell, they allow you to load record definitions used in modules when they were compiled. Use the rr command to load it from your module.

Remember that these are only available for the interactive shell to use.

다른 팁

How do you mean? In the shell, then it is as Christian wrote. If you mean in a module then you still have to define records before you can use them. See the erlang docs, online at http://erlang.org/doc/, for a description on how to do this. They are only a compile time construction, so they don't exist as such.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top