NAME
EAI::File - read/parse Files from the filesystem or write to the filesystem
SYNOPSIS
readText ($File, $data, $filenames, $redoSubDir, $countPercent)
readExcel ($File, $data, $filenames, $redoSubDir)
readXML ($File, $data, $filenames, $redoSubDir)
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). $redoSubDir .. (optional) redo subdirectory, where file can be taken alternatively to homedir. $countPercent .. (optional) percentage of progress where indicator should be output (e.g. 10 for all 10% of progress). set to 0 to disable progress indicator
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). $redoSubDir .. (optional) redo subdirectory, where file can be taken alternatively to homedir.
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). $redoSubDir .. (optional) redo subdirectory, where file can be taken alternatively to homedir.
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) 2024 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.