NAME
Mac::Apps::Seasonality::LoadICAOHistoryFromCSV - Load data from a CSV file into Seasonality's database.
VERSION
This document describes Mac::Apps::Seasonality::LoadICAOHistoryFromCSV version 0.0.4.
SYNOPSIS
use English qw{ -no_match_vars };
use Fatal qw{ open close read write };
use IO::File;
use DBI;
use Mac::Apps::Seasonality::LoadICAOHistoryFromCSV
qw{ load_icao_history_from_csv_handle };
use Mac::Apps::Seasonality::Exceptions;
my $file_handle = IO::File->new('data.csv', 'r');
my $database_connection =
DBI->connect(
"dbi:SQLite2:$database_file_name",
q{},
q{},
{
AutoCommit => 0,
RaiseError => 1,
}
);
eval { load_icao_history_from_csv_handle($database_connection, $file_handle) };
my $exception
if ($exception = Mac::Apps::Seasonality::CSVParseException->caught()) {
...
} elsif ($exception = Mac::Apps::Seasonality::InvalidDatumException->caught()) {
...
} elsif ($EVAL_ERROR) {
...
} # end if
DESCRIPTION
INTERFACE
- load_icao_history_from_csv_handle($database_connection, $io_handle)
-
Takes a reference to a DBI handle and to an I/O handle referring to data in CSV format and loads the data from the handle into the database.
$database_connectionmust be an open handle to an SQLite2 database with Seasonality's schema. This handle must have the RaiseError option set on it; this module does no error checking of database actions on its own.$io_handlemust be an open handle to data in CSV format, with the data on each line in the order described in the documentation for "load_icao_history" in Mac::Apps::Seasonality::LoadICAOHistory. No checking is done for I/O errors, so the use of the Fatal module is highly suggested. The data read from this handle must not contain anything other than the actual data to be loaded. In particular, this means that there cannot be any column headers.If no problems are encountered, the number of data points loaded is returned.
A Mac::Apps::Seasonality::CSVParseException is thrown if the raw input cannot be turned into the module's internal representation.
A Mac::Apps::Seasonality::InvalidDatumException is thrown if an individual value does not fit the constraints required by Seasonality.
DIAGNOSTICS
Error message here, perhaps with %s placeholders-
[Description of error here]
Another error message here-
[Description of error here]
[Et cetera, et cetera]
CONFIGURATION AND ENVIRONMENT
Mac::Apps::Seasonality::LoadICAOHistoryFromCSV requires no configuration files or environment variables.
DEPENDENCIES
None.
INCOMPATIBILITIES
None reported.
BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests to bug-mac-apps-seasonality-loadicaohistory@rt.cpan.org, or through the web interface at http://rt.cpan.org.
AUTHOR
Elliot Shank perl@galumph.com
LICENSE AND COPYRIGHT
Copyright ©2006-2007, Elliot Shank <perl@galumph.com>. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.