Gossamer Forum
Home : Products : DBMan : Customization :

Need Help! - Creating new database

Quote Reply
Need Help! - Creating new database
I pretty much had my dbman all set up the way I wanted it to (had some minor bugs - see my other post about Confirmation Screens), so I wanted to change the names of the files, from default, to match the people I was doing it for. Well, I went and changed the names, changed the .cfg lines to match, and now the thing won't even run. I have checked and rechecked until my eyes are gonna burn out looking at this monitor. So, here is what I am getting:

Code:
CGI ERROR==========================================
Error Message : Error loading required libraries.
Check that they exist, permissions are set correctly and that they compile.
Reason: Invalid config file name: hr_dept at /home/pcgov/cgi-bin/db.cgi line 50.
Script Location : /home/pcgov/cgi-bin/db.cgiPerl Version : 5.00502
Setup File : hr_dept.cfg

I went and looked at the db.cgi file at line 50 and this is what I see...

Code:
# 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"; }
require "$db_setup.cfg"; # Database Definition File
require "auth.pl"; # Authorization Routines
};

Line 50 is the one that starts "unless (....". So I looked at what the $db_setup reffered to, and saw these lines about 10 lines up from this segment, and it is this....

Code:
# 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 = '');

I didn't change a thing in this file, the first line (#!/usr/local/bin/perl) was already correct for my server, so I touched nadda.

Just to make sure nothing was wrong, I reuploaded the original demo version, set the .cfg file for that one to match dir's and such, and it works fine. But all I did was change the names of the files, chaned the corrosponding lines in the renamed .cfg file, and then ran the db.cgi file with the new ?db=hr_dept argument, just like the README file says, and the sky falls in on me.

Any help here is greatly appreciated, and the sooner the better too. Thanks!
Quote Reply
Re: Need Help! - Creating new database In reply to
Ok, so I am posting a reply to my own question, well, I just did some testing and thought some new info might help shed some light...

I went back and re-uploaded all my revised files, but named them as default.* and the revised html.pl file. The whole thing works fine (except for the previous bug, but I am more concerned with this new problem before tackling that).

So...it seems that as long as I leave the files all named as the original default.* and html.pl, everything works. All I do is copy and rename the files to a different name (with corrosponding changs in the .cfg) file, and it goes south. Could someone tell me if there is a step I am missing? I mean really, 'default names - works, different names - does not work'. (I swear this is the only change I am making!) I tell you, this is freaky.

Thanks in advance.
Quote Reply
Re: Need Help! - Creating new database In reply to
Andrew,

I believe your problem is that dbman does not allow you to have an underline character ("_") in the .cfg file name. It appears that you named your .cfg file "hr_dept.cfg".

Line 50 of the db.cgi code performs the following pattern checking:

Code:
($db_setup =~ /^[A-Za-z0-9]+$/) { die "Invalid config file name: $db_setup"; }

This line means that the filename can only have the letters A-Z (capital or lowercase) and the digits 0-9 in it. Any other characters (e.g. an underline) are not accepted and will kill the program and give the error you see.

You can either change the names of your files to not have the underline, or you could try changing the pattern matching to:

Code:
($db_setup =~ /^[A-Za-z0-9\_]+$/) { die "Invalid config file name: $db_setup"; }

to try to allow the underline.

P.S. I haven't tried the new code I gave above, and I am not a PERL expert, but I think the syntax is right.

Sincerely,

Lauren Stegman
Quote Reply
Re: Need Help! - Creating new database In reply to
Lauren Stegman,

Did you get that raise yet? Smile Thanks again, your solution solved the problem and it works great! I would hug ya if I could, but you'll just hafe to settle for another --> Smile

Andrew
Quote Reply
Re: Need Help! - Creating new database In reply to
Your welcome.

Did you just change the names or did you change the pattern matching?

I am interested if the pattern matching bit worked.

Lauren
Quote Reply
Re: Need Help! - Creating new database In reply to
Lauren Stegman,

You are a goddess Smile It works great! Now I can more easily differentiate between my db's. Thank you again!

Andrew