[erlang-questions] Define "exists".
Thu Oct 13 15:28:55 CEST 2011
I think that the modules defining the atoms must be loaded when you call
Can you preloaded those?
On Oct 13, 2011 3:24 PM, "Eric Newhuis (personal)" <>
> The problem is with list_to_existing_atom/1. Really it is a great idea.
> 1. I have raw query strings coming in from the cruel outside world.
> 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.
> 3. With me so far? Good.
> 4. My server, an OTP app, has a .app file that lists several other apps.
> 5. list_to_existing_atom fails on atoms defined in those several other
> Suggestion: The documentation should specify what "exists" really means.
> 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.
> For reference, here is the existing Erlang doc from the .org site:
> list_to_existing_atom(String) -> atom()
> String = string()
> Returns the atom whose text representation is String, but only if there
> already exists such atom.
> Failure: badarg if there does not already exist an atom whose text
> representation is String.
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions