On Thu, 2005-05-26 at 11:16 -0400, Chris Devers wrote: > On Thu, 26 May 2005, Alex Brelsfoard wrote: > > > Picture a web form that is some sort of a survey. When that survey is > > submit the perl script writes out the answers onto a file. That file > > is tab delimited. > > Stop right there, doctor, I think we've found the problem. > > If you used a more robust storage format, this problem would go away,
Aw now that's not nice. I _live_ on tab delimited files! :P > right? For simple, you could just do something like the Windows INI > format, ewww - let's just skip on past this ;) > Or you could get fancy and use a tied hash, a BDB database, a SQLite > database, or a proper database server. Assuming you don't want to use a proper database for some reason (though you should consider it), Chris is correct in pointing out that other data storage formats might be better. DBD or SQLite could be handy, but even YAML could solve your problem. Read in the current set of values, increment/add to the data structure as you parse submission and re-export. Granted, this answer doesn't scale well to thousands of responses and would need to protect against race conditions on the file, but for small surveys it's just fine. And if they are big, then why not a database? What am I missing? Does your code generate the form that the survey is submitted from? How does the client input the survey? We're assuming from your original post that somehow a client generates a survey where you don't know what the fields might be, but then that users submit answers one user at a time and you accumulate these results and return a tab delimited file with the results at some point. Is that correct? --
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm