.beam을 스크립트처럼 써서 코드를 감추고 어디서나 실행하려고 해요.
보통은 여러 파일이 함께 동작하잖아요, 예를 들면:
entry.erl
helper.erl
....
여러 beam 파일을 하나의 beam으로 합칠 수 있나요?
지금 떠오르는 건 beam을 erl 파일에 넣은 뒤 컴파일하는 방법뿐이에요, 이런 식으로요
["[",
lists:map(fun(Artifact) ->
{ok, Payload} = prim_file:read_file(Artifact),
["{", filename:basename(Artifact, ".beam"), ",", io_lib:format("~w", [Payload]), "},"]
end, Artifacts)
"ok]"]
이렇게 만들고
[{module, <<"....">>}]
그다음 code:load_file로 읽는 거죠
영어에서 번역·원문 보기I'm treating .beam as a script so I can conceal my code and execute it any where.
Normally several files cooperate, for example:
entry.erl
helper.erl
....
Can several beam files be combined into a single beam?
My only idea is embedding the beam inside an erl file before compiling that, for example
["[",
lists:map(fun(Artifact) ->
{ok, Payload} = prim_file:read_file(Artifact),
["{", filename:basename(Artifact, ".beam"), ",", io_lib:format("~w", [Payload]), "},"]
end, Artifacts)
"ok]"]
producing
[{module, <<"....">>}]
then loading it via code:load_file