[Pdx-pm] web form and perl question

John Labovitz johnl at johnlabovitz.com
Fri May 7 12:55:18 CDT 2004


On 7 May 2004, at 8:47 AM, Thomas J Keller wrote:

> The web form requires each sample name to be entered in a separate  
> text box. Some clients have multiple samples that they'd like to be  
> able to enter "en masse" i.e. as a batch. I'm considering allowing a  
> file upload, but I'm worried about having to deal with an infinite  
> number of formats to parse down the road.  Are there any simple and  
> safe ways to do batch data entry from a web form?

"Simple and safe" and "web form" don't usually go together. ;)

You'll want to check the web data regardless of the format that you  
allow -- just to make sure it really *is* in that format.

And since you'll be doing that already, you can just enforce a  
particular style -- tab-delimited CSV, XML, etc.  You could probably  
even use the appropriate parsing module to do simple validation.  Eg,  
once the file is uploaded, do a test read using Text::TabFile (see  
CPAN) and make sure you have enough fields, they aren't too long, etc.

I haven't done a whole lot of file-upload work, but the CGI::Simple  
module looks promising.  Here's a relevant link:

	http://search.cpan.org/~jfreeman/Cgi-Simple-0.071/ 
Simple.pm#FILE_UPLOADS

--
John Labovitz Consulting, LLC
http://mac.johnlabovitz.com
johnl at johnlabovitz.com
+1 503.949.3492




More information about the Pdx-pm-list mailing list