The context is a mod_perl Apache http server and DBI access to mysql.
The action of an html form is a perl handler. The handler starts off by getting the request object and reading an identifying cookie:
The handler takes arguments from $r->param and writes them to a mysql table by means of a database handle obtained from DBI->connect.sub handler { my $r = Apache2::Request->new(shift); my %in_cookies = Apache2::Cookie->fetch ($r); my $session = $in_cookies{"ID"} && $in_cookies{"ID"}->value; ...
The problem: it has occurred at least once that data from one call to the handler has persisted to the next and has been written to a record belonging to a different session. Specifically, this section of code misfired, the hash %ship_address somehow retaining data from its previous assignment:
The 2nd customer was very surprised to learn he lived on the 5th floor of a one story house...while ( my ($key,$value) = each %ship_address ) { $dbh->do("update bill set ship$key = ? where session = ?", undef, $ +value, $session);
I am uncertain how to isolate the problem. Can you help? Thanks.
In reply to keeping variables separate by RandomWalk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |