Revision f9f7b56e
Von Sven Schöling vor mehr als 13 Jahren hinzugefügt
t/helper/csv.t | ||
---|---|---|
30 | 30 |
$csv = SL::Helper::Csv->new( |
31 | 31 |
file => \"Kaffee;0.12;12,2;1,5234\n", |
32 | 32 |
header => [ 'description', 'sellprice', 'lastcost_as_number', 'listprice' ], |
33 |
header_acc => { listprice => 'listprice_as_number' },
|
|
33 |
dispatch => { listprice => 'listprice_as_number' },
|
|
34 | 34 |
class => 'SL::DB::Part', |
35 | 35 |
); |
36 | 36 |
$csv->parse; |
37 | 37 |
|
38 | 38 |
is $csv->get_objects->[0]->sellprice, 0.12, 'numeric attr works'; |
39 | 39 |
is $csv->get_objects->[0]->lastcost, 12.2, 'attr helper works'; |
40 |
is $csv->get_objects->[0]->listprice, 1.5234, 'header_acc works';
|
|
40 |
is $csv->get_objects->[0]->listprice, 1.5234, 'dispatch works';
|
|
41 | 41 |
|
42 | 42 |
##### |
43 | 43 |
|
... | ... | |
49 | 49 |
EOL |
50 | 50 |
sep_char => ',', |
51 | 51 |
quote_char => "'", |
52 |
header_acc => { listprice => 'listprice_as_number' },
|
|
52 |
dispatch => { listprice => 'listprice_as_number' },
|
|
53 | 53 |
class => 'SL::DB::Part', |
54 | 54 |
); |
55 | 55 |
$csv->parse; |
Auch abrufbar als: Unified diff
SL/Helper/Csv.pm: header_acc umbenannt in dispatch, Doku, check_header