<p>Hi, </p>
<p>I think that the modules defining the atoms must be loaded when you call to_existing_atom.</p>
<p>Can you preloaded those?<br>
<br>
Regards, vlad<br>
</p>
<div class="gmail_quote">On Oct 13, 2011 3:24 PM, "Eric Newhuis (personal)" <<a href="mailto:enewhuis@gmail.com">enewhuis@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div>The problem is with list_to_existing_atom/1. Really it is a great idea. But...</div><div><br></div><div>1. I have raw query strings coming in from the cruel outside world.</div><div>
2. I convert some bits of those into atoms by way of list_to_existing_atom so that someone cannot kill me with DOS attack by bloating my atom table.</div><div>3. With me so far? Good.</div><div>4. My server, an OTP app, has a .app file that lists several other apps.</div>
<div>5. list_to_existing_atom fails on atoms defined in those several other apps.</div><div><br></div><div>Suggestion: The documentation should specify what "exists" really means.</div><div><br></div><div>Question: What should I do to force the atoms from my dependent apps to be loaded? I've been manually calling Module:module_info/0 just in time but, alas, this is starting to fail due to other module dependencies that are unknown at my call sites.</div>
<div><br></div><div>For reference, here is the existing Erlang doc from the .org site:</div><div><br></div><div><a href="http://www.erlang.org/doc/man/erlang.html#list_to_existing_atom-1" target="_blank">http://www.erlang.org/doc/man/erlang.html#list_to_existing_atom-1</a></div>
<div><p><a name="132fd74948965ec3_list_to_existing_atom-1"><span>list_to_existing_atom(String) -> atom()</span></a><br></p>
<div><p>Types:</p>
<div>
<span>String = string()</span><br>
</div>
</div>
<div><div>
<br></div><p>Returns the atom whose text representation is <span>String</span>,
but only if there already exists such atom.</p><p>Failure: <span>badarg</span> if there does not already exist an atom
whose text representation is <span>String</span>.</p></div></div></div><br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div>