martes, 1 de diciembre de 2009

Better perl dumps than Data::Dumper with xxx::yyy

Sometimes I feel like I don't have a path to follow in the perl world. There's always more and more to learn, and one can't seem to explore all similar modules to do a given task.

For example, some time ago, I posted about Data::Dumper::Perltidy, a way to better format D::D output.

Since then, I've been exploring some other options to do similar things, and today, as I had to start a new project at $work, I decided to give a stab at those other Dumper modules.

I Dicovered a few other modules to dump data, that can also be used for marshalling.

Data::Dump :Really small output, arrays are joined in a single line (if it fits)

Data:Dumper::Concise : Nice options for Data::Dumper, it prints sub codes, and prints \n in strings with newlines instead of the newline char. When its output is evaled, it delievers the same code and data (sub code is there!)


Data::Dump::Streamer :Highly configurable dumper. I haven't tested it. From what I've read, it seems to be the most complete dumper, ideal for complex things, but overkill for simple dumps.

Data::Inspect: Quite small output, very simple to use, and inspired in ruby's p and inspect functions. It has support for printing complete objects.

I haven't pasted examples as you can find them in the cpan page of every module.

Btw, writing perl at $work is great and makes me feel more productive than any other language/task I have to use/do. I'll try further Data::Dump, and Data::Dumper::Concise, and see how does it feel.

2 comentarios:

Joaquin Ferrero dijo...

And Data::Dumper::Names! is more eval()-able.

raig dijo...

Thanks explorer :)

I'll try it too and see.

Damn TIMTOWTDI... :D