rr(Mod) in the shell
Ulf Wiger (AL/EAB)
ulf.wiger@REDACTED
Wed Sep 7 15:55:25 CEST 2005
Agreed. I think it's a good idea too ;-)
(http://www.erlang.org/ml-archive/erlang-questions/200505/msg00201.html)
One problem I ran into was printing from a remote shell.
I haven't checked whether that will be a problem with
your code as well, and it wasn't actually clear to me
why it was happening at all. Something about the translation
of pids, I think, that causes it not to find the ets table
(because it gets confused about whether it is local or remote)
Perhaps that's something one can live with...
/Uffe
> -----Original Message-----
> From: owner-erlang-questions@REDACTED
> [mailto:owner-erlang-questions@REDACTED]On Behalf Of Claes Wikstom
> Sent: den 7 september 2005 13:10
> To: erlang-questions@REDACTED
> Subject: rr(Mod) in the shell
>
>
>
>
> I've become totally and completely addicted to the
> feature of the shell where rr(Mod) in the shell reads the record
> defs of the Module and displays the records nicely in the shell.
>
> It would be very nice if also records could be nicely printed by
> io:format so we could get nice record printouts in logs. Our
> logs are widely populated by ugly record printouts.
>
> I've patched shell.erl and io_lib_format.erl to accomplish
> this. The format char for records is ~r (ofcource)
>
> I'm not claiming that I understand the code in io_lib
> but if you all think that this is also a nice fetaure, maybe
> someone who understands the io_lib code better than me
> could do it properly.
>
>
> As an example, as session from the shell:
>
> (mynode@REDACTED)3> [P] = mnesia:dirty_read({person, 6003310130}).
> [{person,6003310130,
> "Claes",
> "Wikstrom",
> {addr,[],"Malarhojdsvagen 5a",98765,"Stockholm",[],[],[]},
> [],
> [],
> [],
> [{53,"247332"}],
> 0,
> [{4,63279658768},
> {2,63292552384},
> {5,63280394364},
> {3,63283554755},
> {53,63291634548}],
> 63291634548,
> ok,
> 262145024,
> [],
> [],
> 0}]
>
> (mynode@REDACTED)4> io:format("Person ~r", [P]).
> Person #person{pno = 6003310130,
> fname = "Claes",
> lname = "Wikstrom",
> addr = #addr{careof = [],
> street = "Malarhojdsvagen 5a",
> postno = 98765,
> city = "Stockholm",
> telno = [],
> cellno = [],
> email = []},
> post_addr = [],
> extra_company_addrs = [],
> passwd = [],
> estore_names = [{53,"247332"}],
> blacklisted = 0,
> crdata = [{4,63279658768},
> {2,63292552384},
> {5,63280394364},
> {3,63283554755},
> {53,63291634548}],
> crdate = 63291634548,
> crresult = ok,
> credlimit_bits = 262145024,
> letters = [],
> email = [],
> flags = 0}ok
>
>
>
>
> The solution (which I believe has been up for disccussion
> earlier here on the list) is pretty expensive, since all
> record defs from all modules are kept in an ets table. I'd
> say it's worth it though, and if the feature isn't used, the
> ets table never gets created.
>
>
> What do you think ??
>
>
> /klacke
>
>
More information about the erlang-questions
mailing list