ok, i'm posting here because it's a perl problem and there seems to be no activity on dbman board.
i'm using a subroutine to find fieldnames in a dbman cfg file. that part of cfg looks like this (excerpt):
'Lock' => [ 0, 'alpha', -1, 5, 0, 'No', ''],
'Userid' => [ 1, 'alpha', 5, 255, 1, '', ''],
'Business_name' => [ 2, 'alpha', 20, 255, 0, '', ''],
'Firstname' => [ 3, 'alpha', 20, 255, 1, '', ''],
'Lastname' => [ 4, 'alpha', 20, 255, 1, '', ''],
...
'Balance_due' => [36, 'numer', 12, 10, 0, '', '\d+(?=\.\d\d)?$'],
'Mgt_council' => [37, 'alpha', 5, 3, 0, 'No', ''],
'Reserved' => [38, 'alpha', -1, 5, 0, 'xxxxx', '']
);my subroutine is not getting the first field (Lock) and it doesn't get the last two fields. i have no idea why it isn't getting the first one. i'm guessing it quits after Balance_due because of the validation expression that contains quotes and parentheses. can someone tell me how to fix the sub:
$configfile = $db_script_path . "/" . $configfile;
open(FILE, "<$configfile") || &cgierr("Cannot open $configfile.\n$!");
local $/;
#undef $/; # commented to fix a different problem!
while (<FILE>) { if (/(%db_def\s+=\s+\(\s+)('.*?)(\))/s) { $fields = $2;}}
close(FILE);
while ($fields =~ /(\n')(\w+)(')/g) { push (@db2_cols, $2); }
return (@db2_cols);please help! thanks.
i'm using a subroutine to find fieldnames in a dbman cfg file. that part of cfg looks like this (excerpt):
Code:
%db_def = ( 'Lock' => [ 0, 'alpha', -1, 5, 0, 'No', ''],
'Userid' => [ 1, 'alpha', 5, 255, 1, '', ''],
'Business_name' => [ 2, 'alpha', 20, 255, 0, '', ''],
'Firstname' => [ 3, 'alpha', 20, 255, 1, '', ''],
'Lastname' => [ 4, 'alpha', 20, 255, 1, '', ''],
...
'Balance_due' => [36, 'numer', 12, 10, 0, '', '\d+(?=\.\d\d)?$'],
'Mgt_council' => [37, 'alpha', 5, 3, 0, 'No', ''],
'Reserved' => [38, 'alpha', -1, 5, 0, 'xxxxx', '']
);
Code:
$configfile = "members.def"; $configfile = $db_script_path . "/" . $configfile;
open(FILE, "<$configfile") || &cgierr("Cannot open $configfile.\n$!");
local $/;
#undef $/; # commented to fix a different problem!
while (<FILE>) { if (/(%db_def\s+=\s+\(\s+)('.*?)(\))/s) { $fields = $2;}}
close(FILE);
while ($fields =~ /(\n')(\w+)(')/g) { push (@db2_cols, $2); }
return (@db2_cols);