Gossamer Forum
Home : Products : DBMan : Installation :

Error loading required libraries

Quote Reply
Error loading required libraries
I have been having problems with the db.pl "seeing" the default.cfg file. I've checked all of permissions & they seem in check, I also tried to edit the path & I still have had no luck. I looked thru the archive & caught a few errors in default.cfg but I still can not log in. Any suggestion/help would be greatly appreciated! Here are the errors I am recieveing:

hello 2a Content-type: text/html DBMan encountered an internal error.

CGI ERROR
==========================================
Error Message : Error loading required libraries.
Check that they exist, permissions are set correctly and that they compile.
Reason: Can't modify modulus (%) in scalar assignment at c:\Inetpub\wwwroot\cgi-bin\dbman\default.cfg line 102, near ");"
Compilation failed in require at c:\inetpub\wwwroot\cgi-bin\dbman\db.pl line 63.

Script Location : c:\inetpub\wwwroot\cgi-bin\dbman\db.pl
Perl Version : 5.006
Setup File : default.cfg

****************************************************
Here is the default.cfg:

# File and URL's
# --------------------------------------------------------
# URL of the directory dbman resides in. No Trailing Slash Please.
$db_dir_url = "http://localhost/cgi-bin/dbman";
$db_db_path = "c:/regidb/ticker.dat";
# URL of dbman.
$db_script_url = $db_dir_url . "/db.pl";
# Full Path and File name of the database file.
$db_file_name = $db_script_path . "/infotest.dat";
# Full path and file name of the counter file.
$db_id_file_name = $db_script_path . "/default.count";
# Full path and file name of the authorization directory.
$auth_dir = $db_script_path . "/auth,pl";
# Full path and file name of the password file.
$auth_pw_file = $db_script_path . "/default.pass";
# Full path and file name of the log file.
$auth_log_file = $db_script_path . "/default.log";
# Full path and file name of the html routines.
require $db_script_path . "/html.pl";

# Database Definition
# --------------------------------------------------------
# Definition of your database. Format is
field_name => ['position', 'field_type', 'form-length', 'maxlength', 'not_null', 'default', 'valid_expr']

#%db_def = (
# ID => [0, 'numer', 5, 8, 1, '', ''],
# Title => [1, 'alpha', 40, 255, 1, '', ''],
# URL => [2, 'alpha', 40, 255, 1, 'http://', '^http://'],
# Type => [3, 'alpha', 0, 60, 1, '', ''],
# Date => [4, 'date', 12, 15, 1, &get_date, ''],
# Category => [5, 'alpha', 0, 255, 1, '', ''],
# Description => [6, 'alpha', '40x3', 500, 0, '', ''],
# Validated => [7, 'alpha', 0, 3, 1, 'Yes', 'Yes|No'],
# Popular => [8, 'alpha', 0, 3, 0, '', ''],
# Userid => [10,'alpha', -2, 15, 0, '', '']
#
# );

%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Xchange => [1, 'alpha', 15, 255, 1, '', ''],
symbol => [2, 'alpha', 40, 255, 1, '', ''],
currency => [3, 'alpha', 40, 255, 1, '', ''],
Lastprice => [4, 'CHECKBOX', 40, 255, 1, '', ''],
Todayshigh => [5, 'CHECKBOX', 40, 255, 1, '', ''],
Todayslow => [6, 'CHECKBOX', 40, 255, 1, '', ''],
Lasttradedate => [7, 'CHECKBOX', 40, 255, 0, '', ''],
Lasttradetime => [8, 'CHECKBOX', 40, 255, 1, '', ''],
Netchange => [9, 'CHECKBOX', 20, 255, 1, '', ''],
Changefromprevdayclose => [10, 'CHECKBOX', 20, 255, 1, '', ''],
Volume => [11, 'CHECKBOX', 20, 255, 0, '', ''],
Avedailyvolume => [12, 'CHECKBOX', 40, 255, 1, '', ''],
Bid => [13, 'CHECKBOX', 40, 255, 1, '', ''],
Ask => [14, 'CHECKBOX', 40, 255, 1, '', ''],
Previousclose => [15, 'CHECKBOX', 40, 255, 1, '', ''],
Todaysopen => [16, 'CHECKBOX', 40, 255, 1, '', ''],
Daysrange => [17, 'CHECKBOX', 40, 255, 1, '', ''],
X52weekrange => [18, 'CHECKBOX', 40, 255, 1, '', ''],
Earningspershare => [19, 'CHECKBOX', 40, 255, 1, '', ''],
PEratio => [20, 'CHECKBOX', 40, 255, 1, '', ''],
Dividendpaydate => [21, 'CHECKBOX', 40, 255, 1, '', ''],
Dividendpershare => [22, 'CHECKBOX', 40, 255, 1, '', ''],
Dividendyeild => [23, 'CHECKBOX', 40, 255, 1, '', ''],
Maketcap => [24, 'CHECKBOX', 40, 255, 1, '', ''],
Exdividenddate => [25, 'CHECKBOX', 40, 255, 1, '', ''],
Netassetvalue => [26, 'CHECKBOX', 40, 255, 1, '', ''],
Yield => [27, 'CHECKBOX', 40, 255, 1, '', '']
);



# The column name for the database key. Can be any column, but it must be unique!
# You can't have two records with the same key value!
$db_key = 'ID';
# Track the key? Should DBMan keep a counter of the next key to use? This isn't
# neccessary if you can guarantee that your entry in the key field will be unique
# (i.e. a userid).
$db_key_track = 1;
# Database delimeter.
$db_delim = '|';
# Use file locking (1 = Yes, 0 = No). Should be used, but won't work on Win95.
$db_use_flock = 1;
# Auto generate the html forms (1 = Yes, 0 = No).
$db_auto_generate = 0;
# Display Benchmarking Information (1 = Yes, 0 = No).
$db_benchmark = 0;
# Display Debugging Information (1 = Yes, 0 = No).
$db_debug = 1;

# Select fields. Field name => 'comma seperated list of drop down options'.
# %db_select_fields = (
# Category => 'General,Configuration Management,Project
# Management,Process Improvement,Standards,Testing & Quality Assurance',
# Type => 'Web,Newsgroup,Mailing List,FTP,Gopher'
# );

# Radio fields. Field name => comma seperated list of radio buttons.
#%db_radio_fields = ( Step7ProgrammingI => 'Yes,No' );

# Checkbox fields. Field name => Checkbox value.
%db_checkbox_fields = ( Popular => 'Yes' );

# Default maximum number of hits returned in a search.
$db_max_hits = 5;
# Bold search results (1 = Yes, 0 = No).
$db_bold = 1;
# Regular and title fonts used in auto_generatrion and html.pl.
$font = 'font face="verdana,arial,helvetica" size="2"';
$font_title = 'font face="verdana,arial,helvetica" size="4"';

# Authorization Options
# --------------------------------------------------------
# No Authentication? (1 = "there is no authentication", 0 = "there is authentication")
# If you choose no authentication, then set the permissions of what
# people can do with: @auth_default_permissions below.
$auth_no_authentication = 0;

# The amount of time in seconds that user files are kept in the
# auth directory before the program removes them. 2-6 hours is
# probably a good value.
$auth_time = 21600; # 6 hours (in seconds)

# Enable (1) or disable (0) logging.
$auth_logging = 1;

# Allow a default user? This means you can specify a user via the URL
# and skip the logon process. Use this to allow people to search without
# logging on, but require log in if they want to add/modify/remove etc.
# (1 = "yes", 0 = "no")
$auth_allow_default = 0;

# Default permissions used if there is no authentication, or for a default
# user. (View, Add, Delete, Modify, Admin), 1 = enable, 0 = disable.
@auth_default_permissions = (1,1,1,1,0);

# Allow people to sign up for their own userid/passwords? They will
# recieve default permissions.
$auth_signup = 1;

# Permissions a new signup should get.
@auth_signup_permissions = (1,1,1,1,0);

# Registered users: can modify/delete _only_ own records. For this to make
# sense you should set default off or to 1,0,0,0.
$auth_modify_own = 0;

# Registered users: can view _only_ own records. For this to make sense
# you should turn off default permissions.
$auth_view_own = 0;

# Auth user field. This is the field position in the database used for storing
# the userid who owns the record. Set to -1 if not used.
$auth_user_field = -1;

# URL to send user if they chose log off. Leave blank and the script will return to
# the logon prompt (although this only makes sense if you are using authentication).
$auth_logoff = "http://localhost";

# ===========================================================================
# Build up some variables from your definitions. Internal use only.
foreach (sort { $db_def{$a}[0] <=> $db_def{$b}[0] } keys %db_def) {
push (@db_cols, $_);
$db_sort{$_} = $db_def{$_}[1];
$db_form_len{$_} = $db_def{$_}[2];
$db_lengths{$_} = $db_def{$_}[3];
$db_not_null{$_} = $db_def{$_}[4];
$db_defaults{$_} = $db_def{$_}[5];
$db_valid_types{$_} = $db_def{$_}[6];
($_ eq $db_key) and $db_key_pos = $db_def{$_}[0];
}
1;

************************************************************

AND here is the portion of the db.pl I believe I am having problems with:


# If you run into problems, set $db_script_path to the full path
# to your directory.
$db_script_path = "c:\\Inetpub\\wwwroot\\cgi-bin\\dbman\\";
print "Content-type: text/html\n\n";
print "hello\n";

# Load the form information and set the config file and userid.
local(%in) = &parse_form;
$in{'db'} ? ($db_setup = $in{'db'}) : ($db_setup = 'default');
$in{'uid'} ? ($db_uid = $in{'uid'}): ($db_uid = '');
$db_debug = 1;
# Piece together the config filename
#$dbconfigFile = $db_script_path . "/" . $db_setup . "\.cfg";

# Required Librariers
# --------------------------------------------------------
# Make sure we are using perl 5.003, load the config file, and load the auth file.


eval {

#unshift (@INC, $db_script_path);
require 5.003; # We need at least Perl 5.003
unless ($db_setup =~ /^[A-Za-z0-9]+$/) { die "Invalid config file name: $db_setup"; }
print "2a\n\n";
#print "$dbconfigFile\n\n";
require ($dbconfigFile = $db_script_path . $db_setup . "\.cfg"); # Database Definition File
print "2b\n\n";
require ($db_script_path . "/auth.pl"); # Authorization Routines
};
if ($@) { &cgierr ("Error loading required libraries.\nCheck that they exist, permissions are set correctly and that they compile.\nReason: $@"); }

Any ideas??

P. Coleman


Quote Reply
Re: Error loading required libraries In reply to
It seems your checkbox fields are not setup properly which will cause you problems.

And example of how they would look would be:

'Graphic' => [21,'alpha',0,3,0,'','Yes'],

There is an excellent tutorial provided by JPDeni which also contains a configurator. My suggestion would be to take your field list and enter them in the configurator and have that setup your .cfg file for you. It will save you time and you will learn in the process.

http://www.jpdeni.com/dbman

Hope this helps

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: Error loading required libraries In reply to
Thanx for the reply & suggestions. I took a look at the form & it does seem to be formatting the database fields a little bit different than I was. I'll have to take a harder look at it tonight.

One last quick question:

Will the database definition lock up dbman.pl even though the flat file is empty?

I just wanted to sign in & verify the layout of the actual flat file.

Once again any help would be greatly appreciated.

Regards,
Pete C.

Quote Reply
Re: Error loading required libraries In reply to
LoisC was trying to tell you that you have not defined your checkbox fields in default.cfg. Check in this area of your config file:

# Checkbox fields. Field name => Checkbox value.
%db_checkbox_fields = ( Popular => 'Yes' );

You are going to have to make entries for each of your checkboxes, like this:

# Checkbox fields. Field name => Checkbox value.
%db_checkbox_fields = ( Popular => 'Yes',
Exdividenddate => 'YourValue',
Netassetvalue => 'Yourvalue'
);

You do need to read thru JPDeni's tutorial as suggested by LoisC. You can find it here http://www.jpdeni.com/dbman