204 DB2 Deployment Guide
Preparing the Perl application package
This step is to identify all the Perl application files. In real life, the application is
usually under some type of library control system and can be gathered easily. In
our example, we only have a simple Perl application file itso_perlapp.pl for
demonstration purpose. We place it under /perl_deploy/bin.
Preparing the deployment package
To automate the application deployment as much as we can, we create a
deployment script perl_app_install. The script copies the application file, DBI file,
and DBD::DB2 file to the specified path. It also installs the and makes Perl
recognize the driver file. It also installs the DBI and DBD::DB2 driver.
Example 4-44 shows the deployment script. There are two command line options
for the scr ipt:
򐂰The flag -p specifies the location where application to be deployed.
򐂰The flag -s specifies the DB2 Home path.
Example 4-44 Code of script perl_app_install
#!/usr/bin/ksh
##########################################################################
#
# Deploy application and perl driver files to target path
#
# perl_app_install -p <installpath> -s <db2homepath>
#
# -p specify the location where application and driver files to be deployed
# -s specify the DB2 Home path
#
# example: perl_app_install -p /home/db2app/myapp -s /home/db2inst1/sqllib"
#
##########################################################################
#set -x
# Define variables
DIR_APP=bin # directory for applications
DIR_DRV=driver # directory for dbi and dbd::db2 file
unset REGVAR
# command-line syntax
syntax()
{
echo "
perl_app_install -p <installpath> -s <sqllibpath>
-p specify the location where application and ODBC lib files will be deployed
-s specify the DB2 Home path
example: perl_app_install -p /home/db2app/myapp -s /home/db2inst1/sqllib"
}