In need of help again, haven't been able to get past 2 syntax error mssgs:
Made a number of changes in my script and now can't even get it to compile:
relevant snippet follows the error mssgs, then the whole script is shown
further down.
Error Mssgs.
1. syntax error at clientdata.cgi line 71, near "}"
(Might be a runaway multi-line "" string starting on line 69)
2. syntax error at clientdata.cgi line 75, near "}"
Snippet
...
$dbm = tie %storedH, 'MLDM', 'client.dbm', O_CREAT|O_RDWR, 0640, $DB_HASH
or die "Cannot open file 'client.dbm': $!\n";
foreach $keyouter(sort keys %dbm) {
foreach $keyinner(keys %{$dbm{$keyouter}}){
If ($dbm{$keyouter}{$keyinner} == "LN")
{
print "localtime($dbm{$keyouter}) \t
Last Name = $dbm{$keyouter}{$keyinner}\n";
} ### <--- Line 69
else
{
print "\t\t\t\t\tCountry = $dbm{$keyouter}{$keyinner}\n";
}
}
};
...
?? Any ideas why this code will not compile.
?? Why doesn't, %dbm = (%dbm, %newH); , append %newH to %dbm? It seems to
want to over-write. (Line 44 below.)
Thanks much for your considerations. Ed
______________ The whole script___________________
#!/usr/bin/perl
## clientdata.cgi
## Test run of DB_FilE
# $TS = time(); # LN and CN will be supplied by a form
# %visitor = (
# $TS => { ## 1st appended hash
# LastName = LN,
# Country = CN,
# },
# _next appended hash here -- ## Next appended hash
# );
use lib '/home/sites/site61/users/esickafus/tmp';
use lib '/home/sites/site61/users/esickafus/tmp/MLDBM-2.01/lib';
use MLDBM qw(DB_File Storable); # Store multi-level hash structure in
single level tied hash
use Fcntl; # to get 'em constants
use strict ;
use DB_File ;
use vars qw($TS $LN $CN %newH $dbm %dbm %storedH $keyouter $keyinner ) ;
$TS = time();
#%visitor_bffr = ( # data from form:
# 'LN' => param('LN'), # Last name
# 'CN' => param('CN'), # Country
# );
$LN = 'Washington'; # test value
$CN = 'Costa Rica'; # " "
$newH{'TS'} = $TS;
$newH{'TS'}{'LN'} = $LN;
$newH{'TS'}{'CN'} = $CN;
## Append %newH hash onto stored hash.
$dbm = tie %storedH, 'MLDM', 'client.dbm', O_CREAT|O_RDWR, 0640, $DB_HASH
or die "Cannot open file 'client.dbm': $!\n";
%dbm = (%dbm, %newH);
undef $dbm; # <<== Line 44
untie %storedH;
## SCRIPT FOR INTERROGATING STORED VISITOR DATA
## *** Printed HoH format ***
##
## %clientdbm =
## Mon Apr 5 16:23:33 2002 Last Name = Sickafus
## Country = USA
##
## Tue Jan 21 15:39:02 2003 Last Name = Washington
## Country = France
## Sort the stored hash on TS and print it.
$dbm = tie %storedH, 'MLDM', 'client.dbm', O_CREAT|O_RDWR, 0640, $DB_HASH
or die "Cannot open file 'client.dbm': $!\n";
foreach $keyouter(sort keys %dbm) {
foreach $keyinner(keys %{$dbm{$keyouter}}){
If ($dbm{$keyouter}{$keyinner} == "LN")
{
print "localtime($dbm{$keyouter}) \t
Last Name = $dbm{$keyouter}{$keyinner}\n";
}
else
{
print "\t\t\t\t\tCountry = $dbm{$keyouter}{$keyinner}\n";
}
}
};
undef $dbm;
untie %storedH;
___________End of Script ____________________________________________
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]