NAME
Text::ETSV - Manipulate ETSV (Enhanced Tab Separated Values).
SYNOPSIS
use Text::ETSV;
my %param = (
name => 'Masanori HATA' ,
mail => 'lovewing@dream.big.or.jp',
sex => 'male' ,
birth => '2005-09-26' ,
nation => 'Japan' ,
pref => 'Saitama' ,
city => 'Kawaguchi' ,
tel => '+81-48-2XX-XXXX' ,
fax => '+81-48-2XX-XXXX' ,
job => 'student' ,
role => 'president' ,
hobby => 'exaggeration' ,
);
my $encoded = etsv_encode(%param);
my %decoded = estv_decode($encoded);
DESCRIPTION
This module provides functions to manipulate ETSV. ETSV (Enhanced Tab Separated Values) is a data table format which I originated. This enhancement to TSV format has two features.
- 1. escaped characters
-
Only five kind of charaters are escaped. Those are [TAB] (for the column separater), [CR] or [LF] (for the line separater), '=' (for the name-value separater) and '%' (for the token of escaped string).
- 2. object oriented values
-
All of values are coupled with its name. So all of values know their name by themselvs. It is like an object oriented way. Besides of a few size of overhead, it is very useful for the human usability and flexibility.
For example, a ETSV data table is like below:
name1=value1[TAB]name2=value2[TAB]name3=value3[TAB]...[LF]
name1=value1[TAB]name2=value2[TAB]name3=value3[TAB]...[LF]
(...)
FUNCTIONS
- etsv_encode(%param)
-
This function encode some hash (%) parameters to a line (table row).
- etsv_decode($row)
-
This function decode a ETSV encoded row to hash (%) parameters.
TSV vs CSV
I prefer to use TSV rather than CSV. Because, [TAB] is the control character just for the purpose, isn't it? Comma is not a control character and it is used also for human language purpose. Need for escaping comma in CSV would happen oftenly while that for escaping [TAB] in TSV would rarely.
AUTHOR
Masanori HATA <lovewing@dream.big.or.jp> (Saitama, JAPAN)
COPYRIGHT
Copyright (c) 2005 Masanori HATA. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.