Used By: Perl CGI Script Developer
This output file was created by CGIScripter version 1.48 on Sat Jul 12 10:14:55 2003. By .com Solutions Inc. www.dotcomsolutionsinc.net
The generated Perl code is designed to be easily updated due to its organized structure and documentation. Commonly changed parameters such as connection strings, table names and error messages are defined near the start of each script. The generated scripts utilize commonly available open source Perl modules including CGI.pm and DBI/DBD in order to make it practical for a developer to make more extensive changes.
One minor change which can easily be made to the generated
scripts involves the display of visible borders for HTML tables. By
default, the generated scripts set the table border to "1"
which makes the table borders visible. To make the table borders invisible,
just change the following line of code to set the border to "0":
Generated CGI Scripts
1) Fill in the database related fields within the CGIScripter
Using FmPro Migrator Files with CGIScripter
Web Server Setup Instructions
The CGI.pm Perl module is included as a standard component with current Perl distributions so you should not generally need to install it. If a reinstall of the CGI.pm module is required, it may be downloaded from www.cpan.org.
For database access by scripts running on the web server
it is necessary to first install database client software and DBI/DBD
driver software on the web server.
Install the MySQL database client only or client and server
software on the web server. The MySQL software must be installed before
the DBI/DBD software is installed. Configure the MySQL user account
for proper authentication to connect to the MySQL database. This will
generally mean enabling access to the database from the IP address of
the webserver machine. Test the database connection with the mysql utility.
MySQL LONG/BLOB data notes:
The MySQL database also includes a max-allowed-packet
variable which limits the maximum amount of data which can be written
into a database row at one time. If large images can't be inserted into
the database, check for errors in the webserver error.log file like
This MySQL variable may be increased by entering the updated
value into the mysqld configuration file (/etc/my.conf on UNIX/Linux):
Make each script executable by the user who owns the web
The Perl scripts will be executed by the web server software whenever they are accessed because they are associated with the Perl executable by virtue of the fact that each script contains the line: #!/usr/bin/perl
Folder Tab - Field Descriptions
File Version field - The File Version field is used to add a version number to each generated script and HTML file. Each major revision of the scripts for a website may utilize a different version number. This feature enables webmasters to perform testing of new scripts with differing version numbers while maintaining existing scripts on the website. Once the testing has been completed, the top level HTML filenames may be changed in order to switchover to the new design with minimal impact to web visitors. If problems are encountered with the new scripts, the site can quickly be switched back to the previous HTML and scripts by swapping the top-level HTML files which submit info to the cgi scripts.
Click the Browse button to select an existing or to create a new folder which contain the files created by CGIScripter. You must have write access to the output directory selected, otherwise an error dialog will be displayed.
Path to Perl field - This field contains the path to the Perl executable application for Linux/UNIX/Mac OS X servers.
Database menu - Select the type of database which will be used by the Perl CGI scripts. The output code and instructions will be customized for the type of database selected in this menu.
Table Name field - The name of the database table used by the generated Perl CGI scripts should be entered in this field. If the table does not yet exist, the DBA may use the example_create_table1.sql SQL script generated by CGIScripter to create this table within the database.
Site Folder Tab - Field Descriptions
Open... - File Menu item - The Open menu loads migration specific information from the filename.txt file selected by the user. This menu item also loads the filename.cgi file (if it exists) which contains previously saved CGI-specific information.
Save As... - File Menu item - The Save As menu saves database specific information into the filename.txt file (where "filename" is the filename entered by the user). CGI specific information (if it has been entered) is also saved by this menu selection as a file named filename.cgi into the same directory. If no CGI specific information has been entered a filename.cgi file is not created.
Forms field - Once the CGI specific data has been loaded by selecting Open... from the File menu, the fields named Forms and Fields will be populated with information about the web forms and fields. Clicking on any individual form name will present the user with the top level Form screen for that particular form.
Fields field - The Fields field will be populated with the fields associated with an individual form. Clicking on any individual field will present the user with the screen of info for that particular field. Clicking on either a field or form name will instantly present the user with the relevant information for the form or field which has been selected.
Generate CGI button - If CGI specific information has been entered, Perl CGI scripts are generated for each form.
Web Server menu - The two types of supported web servers are UNIX (which includes Linux and MacOS X) and Windows. CGI scripts generated for UNIX web servers are optimized for use with the Apache web server. This means that it is important for the Path to Perl field to be filled out correctly on the General tab for proper execution of the scripts by the web server software. Also, Perl CGI scripts generated for UNIX servers do not utilize the ".pl" filename extension. This feature deprives a potential web attacker of information regarding whether the scripts are created as Perl, PHP, shell scripts or some type of binary compiled application. If Windows is selected as the web server OS, the ".pl" extension is added to each CGI script so that scripts are executed by the Perl interpreter. A creative Windows webmaster could generate scripts for a UNIX server, manually append the ".cgi" extension to each file and then use Windows to associate the ".cgi" extension with the Perl interpreter. [If an Oracle database is used, this creative solution would also require manually compiling the DBD::Oracle driver for use with Oracle 8 if CLOB/BLOB objects were utilized within the database table.]
Display Results menu - Query results lists are limited to the number of results displayed per web page which have been selected in this menu. If additional results are available, the user is able to click on a Next link to display additional information.
Max Submit Size field (Bytes) - For security purposes is it necessary to limit the amount of info which is accepted by the script from submit forms. This limitation is implemented in order to prevent a web attacker from accomplishing a denial of service or buffer overflow attack on the web server. Exceeding the specified limit defined in this field causes CGI.pm to zero out the data for all submitted fields. When this occurs, all data validation subroutines which require a minimum number of characters to be entered will fail - even if info has been properly entered into the field. The web developer needs to plan for the maximum amount of data which will be processed by the script in order to prevent unexpected behavior for web users. The default value of 10000 bytes is generally a high enough number for most text forms, but often won't be high enough for insertion of images into the database. Each Perl CGI script generated by CGIScripter which processes LONG/BLOB data is also designed to limit the amount of LONG/BLOB data to the value specified for the Max Submit Size on the Web Site tab of CGIScripter. The Max Submit Size should be configured to handle the maximum amount of data which will be processed by the script in one submission. A script which needs to handle 10,000 bytes of text plus the uploading of five 100,000 byte images in the same submission should be configured with the Max Submit Size set for 510,000 bytes.
Website URL field - The website URL entered into this field is used for creating script submission URLs. The string "http://" may be prefixed to the URL, or it will be added by CGIScripter if it is omitted. For testing purposes, an IP address to a test web server may be entered into this field. Once testing has been completed, the correct website URL may be entered here in order to generate scripts for the production web server.
Folder Tab - Field Descriptions
Form Name field - This field displays the name of the form which is currently being viewed. To change the name of a form, change the name of the form in this field. The name of the form will be changed once the cursor is moved to another field on the screen.
HTML Header field - The information contained within this field is used to create an external HTML file which is loaded and displayed dynamically by the CGI scripts. This external HTML file is expected to be located by default from within the cgi-bin directory - however the Perl scripts may be updated manually to change this location. This external HTML file may be edited independently by the webmaster without any knowledge of Perl CGI programming. If no information is entered into this field, default HTML header information located within each Perl script is used for creating each dynamic web page.
HTML Header Replace All button - Clicking this button replaces the HTML Header information on all of the other forms with the contents of the HTML Header field on the form currently being viewed.
HTML Footer field - This information is used to create the external footer HTML file. This is the HTML footer information which is displayed after the dynamically generated information on dynamic web pages.
HTML Footer Replace All button - Clicking this button replaces the HTML Footer information on all of the other forms with the contents of the HTML Footer field on the form currently being viewed.
Security menu - The two options on this menu are None
and Secure. If the Secure option is selected, the URLs created for posting
info to web pages will be created with an "https" prefix instead
of an "http" prefix.
Submit Success URL field - If the Submit Success URL is filled in, the user will be redirected to the URL specified in this field upon successful completion of insert, update and delete scripts.
Submit Success Text field - If the Submit Success URL field is not filled in, the text listed in the Submit Success Text field will be displayed upon successful completion of insert, update and delete scripts.
Folder Tab - Field Descriptions
Display As field - The default value for the Display As field content is the as the field name. The field name may not be suitable for display on a web page therefore this field provides a way to change the displayed name of each field.
Field Type - The Field Type menu is used to specify the
type of data which will be stored in the field. The following menu options
are available for the Field Type menu:
Auto-Enter menu - The Auto-Enter menu enables auto-enter
values. Fields may contain Auto-Enter Creation Time, Creation Date,
Data, Modification Date, Modification Time, Perl Calculation or Serial
Number. The Auto-Enter Creation Date/Time parameters are only used when
new records are created. The Auto-Enter Modification Date/Time parameters
are only used when a record is updated, not when it is created. The
Auto-Enter Data parameter is a static value consisting of text or numbers
which is entered upon record creation or modification. The static Data
value needs to be entered into the "Result =" field. The Perl
Calculation parameter is used during record creation and updating. The
Perl code for the calculation needs to be entered into the "Result
=" field and does not need to be terminated with a ";".
Result = field - This field is used for additional parameter specifications based upon the value selected for the Auto-Enter menu. If using the Auto-Enter Data or Auto-Enter Perl Calculation, the appropriate values or Perl code need to be entered into this field. The Perl calculation may make use of any existing Perl variables which have already been declared in the output script at the time the Auto-Enter directives are processed. Any syntax errors in the entered Perl code will cause the CGI script to stop running (script processing errors can be found within the web server error.log file).
Display Value List menu - The two options for this menu are None and From Value List. If the From Value List menu item is selected, the values for the value list should be entered into the Value List Items field. Value List items are used to build Submit, Query and Delete HTML pages.
Value List Items field - If the "From Value List" option is selected in the Display Value List menu, the value list items should be entered in this field.
Validate Data Entry menu - The options for this menu include None, Not Empty, Characters Only, Numbers Only, Numbers and Characters Only and Email Address. These validation options are checked during Submit and Update form processing.
Validate Numeric Range Low field - If validation of a numeric range is required, the lower range should be entered into this field.
Validate Numeric Range High field - If validation of a numeric range is required, the higher range should be entered into this field.
Number of Characters Min field - If a minimum number of characters must be entered into the field, the minimum number should be entered into this field.
Number of Characters Max field - If a maximum number of characters should not be exceeded for the field, this maximum number should be entered into this field.
Custom Validation Text field - A standard generic error message is generated for each validation test. However a custom error text message may be specified within this field in order to override the standard message. This message will be displayed for each validation error which occurs for the field. The text entered within this field should be terminated by an HTML <BR> command. All other HTML commands may be included as well.
Most web development troubleshooting may be performed by using information written to the web server error.log file. Additional information may be written to this file by using the Perl warn "" feature to write variable contents to the error.log file.
Perl DBI/DBD module related information may also be written to a log file. Each CGI script generated by CGIScripter contains a debug variable near the start of the program. Changing this variable from 0 to 1 will enable DBI/DBD debugging the next time the script is executed. On UNIX servers you may find that your web server software user does not have enough privileges to write the dbitrace.log file specified in the CGI script. Directory permissions may be changed to allow this file to be written if desired, however this information gets written to the Apache error.log file anyhow. On Apache web servers running on Windows, this log file will generally be created and can be viewed within the directory containing the CGI script.
Form validation fails while uploading images (or no data
is written to the database) - If the combined data submitted to the
database exceeds the value defined for $CGI::POST_MAX, then CGI.pm will
often clear the data for all of the fields prior to passing the info
to the script for processing. This feature is designed to prevent a
web attacker from sending enough data to your script to cause a buffer
overflow in an attempt to gain root access over the web server.
syntax error at C:/test/Apache2/cgi-bin/form_-_depreciation_query1.pl
line 283, near "abcdef - This error shows how a syntax error may
show up in the error log.
DBD::mysql::st execute failed: Got a packet bigger than
'max_allowed_packet' - Even if the value for $CGI::POST_MAX is high
enough for processing by CGI.pm, the MySQL max-allowed-packet database
variable may be configured for a lower value.