<div dir="ltr">I have 2 production systems, one Erlang and one not, both maintaining copies of a large, deeply-nested Erlang data structure.  I need to set up a monitoring script to confirm that both systems are holding identical copies of the data structure.<div>
<br></div><div>The non-Erlang system is holding an ASCII rendering of the data structure.  Computing an MD5 sum of this string is easy.  If I can get the Erlang system to convert its data structure to a string, I can have it compute an MD5 sum as well and the monitoring is simply a matter of comparing hashes.</div>
<div><br></div><div>I'm stuck on the process of converting the Erlang term to a string.</div><div><br></div><div><font face="courier new, monospace">Str = io_lib:format("~p", [Data])</font></div><div><font face="courier new, monospace"><br>
</font></div><div><font face="arial, helvetica, sans-serif">gives me what I want, except that it includes newlines and indentation that I can't expect the non-Erlang system to have.</font></div><div><font face="arial, helvetica, sans-serif"><br>
</font></div><div><font face="courier new, monospace">Str = io_lib:format("~w", [Data])</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">eliminates the newlines and indentation but renders the textual components of Data as lists of integers, guaranteeing the result won't match the non-Erlang system.</font></div>
<div><br></div><div>So the question is, how do I get a "~p"-style rendering of an arbitrarily-large Erlang term <i>without</i> newlines and indentation?</div><div><br></div><div>Thank you!</div><div><br></div><div>
~Brandon Clark</div><div><br></div></div>