NAME
EAI::File - read/parse Files from the filesystem or write to the filesystem
SYNOPSIS
readText ($File, $data, $filenames)
readExcel ($File, $data, $filenames)
readXML ($File, $data, $filenames)
writeText ($File, $data)
writeExcel ($File, $data)
DESCRIPTION
EAI::File contains all file parsing API-calls. This is for reading plain text data (also as quoted csv), reading excel data (old 2003 and new 2007+ format), reading xml data, writing plain text data and excel files.
API
- readText ($$$)
-
reads the defined text file with specified parameters into array of hashes (DB ready structure)
$File .. hash ref for File specific configuration $data .. hash ref for returned data (hashkey "data" -> above mentioned array of hashes) $filenames .. array of file names, if explicit (given in case of mget and unpacked zip archives).
returns 0 on error, 1 if OK
- readExcel ($$$)
-
reads the defined excel file with specified parameters into array of hashes (DB ready structure)
$File .. hash ref for File specific configuration $data .. hash ref for returned data (hashkey "data" -> above mentioned array of hashes) $filenames .. array of file names, if explicit (given in case of mget and unpacked zip archives).
returns 0 on error, 1 if OK
- readXML ($$$)
-
reads the defined XML file with specified parameters into array of hashes (DB ready structure)
$File .. hash ref for File specific configuration $data .. hash ref for returned data (hashkey "data" -> above mentioned array of hashes) $filenames .. array of filenamea, if explicit (given in case of mget and unpacked zip archives).
returns 0 on error, 1 if OK
For all read<*> functions custom "hooks" can be defined with fieldCode and lineCode to modify and enhance the standard mapping defined in format_header. To access the final line data the hash %EAI::File::line can be used (specific fields with $EAI::File::line{<target header column>}). if a field is being replaced using a different name from targetheader, the data with the original header name is placed in %EAI::File::templine. You can also access data from the previous line with %EAI::File::previousline and the previous temp line with %EAI::File::previoustempline.
- writeText ($$)
-
writes a text file using specified parameters from array of hashes (DB structure)
$File .. hash ref for File specific configuration $data .. hash ref for returned data (hashkey "data" -> above mentioned array of hashes)
returns 0 on error, 1 if OK
- writeExcel ($$)
-
writes an excel file using specified parameters from array of hashes (DB structure)
$File .. hash ref for File specific configuration $data .. hash ref for returned data (hashkey "data" -> above mentioned array of hashes)
returns 0 on error, 1 if OK
COPYRIGHT
Copyright (c) 2023 Roland Kapl
All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.