i am trying to use dbmopen with a simple database. it works no problem if i use from a command prompt, but when running from web page. i do not get any errors back in the browser, but the file is never created. if i create first, it is never updated. i also tried using tie( ) instead of dbmopen. my system is using perl 5.8.0 and apache 2.0.
any suggestions?
here is code:
with dbmopen( ):
my %accounts = (1=>"Books", 2=>"Car_Repair", 3=>"Clothes",4=>"Food",5=>"Movie_Rental");
my $account = param('account');
my $dollars = param('dollars');
my $cents = param('cents');
my $account_to_modify = $accounts{$account};
my $amount_to_add = $dollars + ($cents/100);
dbmopen (my %expenses, "expense_fileb", 0644);
if ($expenses{$account_to_modify}) {
$expenses{$account_to_modify} = $expenses{$account_to_modify} + $amount_to_add;
}
else {
$expenses{$account_to_modify} = $amount_to_add;
}
dbmclose (%expenses);
with tie( ):
my %accounts = (1=>"Books", 2=>"Car_Repair", 3=>"Clothes",4=>"Food",5=>"Movie_Rental");
my $account = param('account');
my $dollars = param('dollars');
my $cents = param('cents');
my $account_to_modify = $accounts{$account};
my $amount_to_add = $dollars + ($cents/100);
tie (my %expenses,'DB_File', "expense_fileb");
if ($expenses{$account_to_modify}) {
$expenses{$account_to_modify} = $expenses{$account_to_modify} + $amount_to_add;
}
else {
$expenses{$account_to_modify} = $amount_to_add;
}
untie (%expenses);