|Pathologically Eclectic Rubbish Lister|
Re: RFC: Data::Dumper::Simpleby Aristotle (Chancellor)
|on Jul 31, 2004 at 19:10 UTC||Need Help??|
To be honest I shy away from anything that relies on Filter::*.
I don't see it as particularly necessary here either, as to me, the greatest annoyance has always seemed to be the fact that named variable output requires passing two parallel arrays — rather than, as would seem more natural, hash-like named parameters. Something like this would suffice for me:
This also makes the subtle typo you demonstrated much less likely.
(Assume that you are allowed to say '$foo' => $foo where you need the control.)
I am guessing this is all because whoever wrote Data::Dumper wanted the Dump() function to more-or-less DWIM, so that you wouldn't have to remember to call different functions for named or anonymous output. That could easily be achieved as well — Dump() could expect exactly one array- or hash-ref for anonymous or named output, respectively. This gives
The price is, of course, that you have to use the appropriate set of delimiters.
Another thing that bugs me about Data::Dumper is the OO interface. The constructor takes no options, you have to set them all with one mutator call each. I'd much prefer the former:
Or something along these lines. There are numerous problems with my propositions here; I've never entirely thought this all through. All I'm really saying is that Data::Dumper really has a pretty awful interface, and that it should be possible to sanitize it and keep it DWIMmish without resorting to filters.
Makeshifts last the longest.