Skip to content

byurko/perl_import

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project: perl_import
Author: Brian Yurko

The purpose of this project is to:
----------------------------------
parse file.xml using Perl and store the data in a local SQLite database
ensure that duplicate values are not created upon importing this file subsequent times
create a web application to display the results stored in the database

I would liked to have spent additional time making this project more polished and anticipating error conditions that I did not, but I was challenged by the basic requirements as I have not worked with the requisite technologies recently.
For example, I could have composed Perl code which was more object oriented. I could have written better error handling methods for a mal-formed or missing XML file. I could have written a function that would create the required database if it is missing.

Usage:
------
[creating the database]
It is no longer required to create the database in advance, outside of the import program.
If "import.pl" is run without a local database present, it will create one.

[parsing and importing the feed]
$ perl import.pl
The import.pl program expects files.xml to be present in the current directory, rather than specified as a command line argument.

[displaying the results]
Move display.pl to an appropriate web root with proper cgi permissions (sometimes this requires setting an executable bit)
Assure the web server is configured to support this file extension type and execution mode.
In my case, it was installed to http://localhost/cgi-bin/display.pl
Browse to the page

Creating and initializing the SQLite database.
----------------------------------------------
I was thinking that we would check for and if not existing, create the database from DDL within the Perl environment.
Since I have not been using DBI or DBD very often, I will end up predefining the schema for the DB and importing it via 'sqlite3 import.db' (then) '.read schema.sql'

I have not created adequate foreign key constraints between the three tables.
I have not created indexes for the tables.
I have not created all of the possible NOT NULL constraints.

Files:
------
README - this file
file.xml - sample data
import.pl - program to be run to import file.xml
display.pl - CGI.pm program to display data from sqlite
	This file does not create the database file or ensure it is present in the proper place upon any web server.
	Most web server cgi-bin directories are not writable by average users. You will have to 
	place this file and the data file into place but once it is in a proper place for your 
	server configuration to execute CGI scripts written with Perl, it should run fine. (set the executable bit)
schema.sql - copy of the database schema, suitable for importing into sqlite

Database:
---------
To initialize the database:
cd to the project directory
run: sqlight3 import.db
> .read schema.sql
> .quit

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages