New Books List
Information for Developers
Perl
All of the New Books List programs are written in Perl, an interpreted high-level programming language of many wondrous and varied uses.
Customization of the programs beyond the configuration options, language modules, and SQL queries, assumes some Perl (or similar) programming experience.
newbooks.pl
This program extracts data out of the Voyager database and puts it into a flat file. The Perl DBI and DBD::Oracle modules provide an SQL interface.
These modules are installed by Endeavor on the Voyager database server, but if you choose to run newbooks.pl on another server, you may need to install them yourself.
The easiest thing to modify in this program would be the SQL queries. Just be sure to map the output into the proper format (see the newbooks.txt section below).
Consult the MARC to Latin character set conversion pages, if you are interested in expanding or improving upon the functionality of that routine.
Note that newbooks.pl includes the Perl "strict" pragma, which is good programming practice but which also means that it will be particularly picky about syntax at runtime. If you find this to be unduly burdensome, you can always remove that line of code.
newbooks.txt
This is the flat-file database that is output by newbooks.pl. Each line constitutes a record, and each record contains a set number of tab-delimited fields. Some fields may contain no data.
It is important for developers to understand that the structure of this file is the only thing that ties together newbooks.pl and newbooks.cgi.
Any change to the upstream program (newbooks.pl) that impacts the structure of newbooks.txt, must be accommodated in the newbooks.cgi code that reads in and parses the file.
|
newbooks.pl
|
newbooks.txt
|
newbooks.cgi
|
variable name (sql pass 1)
|
charset conversion
|
field
|
data element
|
variable name
|
|
$entry[0]
|
N
|
1
|
ISBN
|
$isbn
|
|
$entry[1]
|
Y
|
2
|
author
|
$author
|
|
$entry[2]
|
Y
|
3
|
title (full 245 field)
|
$title
|
|
$entry[3]
|
Y
|
4
|
edition
|
$edition
|
|
$entry[4]
|
Y
|
5
|
publisher info
|
$imprint
|
|
$entry[5]
|
N
|
6
|
permanent location
|
$location
|
|
$entry[6]
|
N
|
7
|
temporary location
|
$location_temp
|
|
$entry[7]
|
Y
|
8
|
display call number
|
$dispcallno
|
|
$entry[8]
|
Y
|
9
|
normalized call number
|
$callno
|
|
$entry[9]
|
N
|
10
|
URL
|
$web_link
|
|
$entry[10]
|
N
|
11
|
link text
|
$link_text
|
|
$entry[11|12]
|
N
|
12
|
interval number
|
$week
|
newbooks.cgi
This program lends itself to minor modifications of HTML output, but any structural changes to things like the sorting routines will be more of a challenge.
The ability to manipulate a flat-file database to the extent that is done with this program, is largely dependent on the use of complex data structures such as anonymous arrays. Srinivasan's Advanced Perl Programming (see Resources below) does an excellent job of explaining complex data structures.
Note: newbooks.cgi does not use the strict pragma because doing so can be problematic for CGI programs that parse form data and/or include source code from external files.
|
Resources
|
Learning Perl, 3rd ed.
by Randal L. Schwartz and Tom Phoenix
O'Reilly & Associates, 2001
|
Programming the Perl DBI
by Alligator Descartes and Tim Bunce
O'Reilly & Associates, 2000
|
Programming Perl, 3rd ed.
by Larry Wall, Tom Christiansen, Jon Orwant
O'Reilly & Associates, 2000
|
Perl Cookbook
by Tom Christiansen and Nathan Torkington
O'Reilly & Associates, 1998
|
Advanced Perl Programming
by Sriram Srinivasan
O'Reilly & Associates, 1997
|
CGI Programming with Perl, 2nd ed.
by Scott Guelich, Shishir Gundavaram, Gunther Birznieks
O'Reilly & Associates, 2000
|
|