Do you have a question? Post it now! No Registration Necessary. Now with pictures!
December 28, 2004, 4:00 pm
rate this thread
makes it easy if a form changes, there is no need to change a database
structure. I was wondering if others do it this way, saving all of
their web form data to a hash and putting it in Apache::Session to call
out later with the session id number. It's like leaving your clothes
at the dry cleaners and taking a ticket home to retrieve the clothes at
a later time.
Here is a sub I wrote to handle the work:
my ($dbh,$hash_ref,$sess_id_ref,$action) = @_;
tie %session, 'Apache::Session::MySQL', $$sess_id_ref,
$$sess_id_ref = $session;
if ($action =~ /write/i)
= $ for keys %}
elsif ($action =~ /read/i)
= $session for keys %session}
elsif ($action =~ /delete/i)
the hash referenced by $hash_ref is either filled with data or is to be
filled with data depending on the value of $action. Same with
It is tested and appears to work fine. I started with a big mess of
code and tried to clean it up by using statement modifiers.
Any advice on code would be appreciated and on the soundness of the
overall method of using Apache::Session for storing fairly large
amounts of important data from html forms.
- » Posting Guidelines for comp.lang.perl.misc ($Revision: 1.5 $)
- — Previous thread in » PERL Discussions