2008-06-16T06:52:10+01:00

Text::ECSV

JSON? YAML? CSV? XML? …? ECSV!

Roland Giersig had a presentation at YAPC 2007 called 'Techniques for Remote System-Monitoring'. He was explaining his search after a good logging format or how to store continuous flow of data in a most usable form.XML? YAML? CSV? XML is nice but for a machines not for humans, YAML is nice for both but it's hard to grep. CSV is readable and grep-able but not too flexible. So what is the conclusion? ECSV is like a CSV but in each comma separated field the name of the column is set. This gives a flexibility to skip, reorder, add the fields. All the information is stored per line so it's easy to grep. Also it's easy to compare two records by md5-ing the lines or doing string eq.

For my next project I'm going to play with this idea so I've create new module - Text::ECSV. Basically all it does is that in addition to the Text::CSV functionality it also gets the key/values from the CSV fields and store them in a hash for easy accessing.