[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cgiapp] RFC: Data::FormValidator 4.0


On Date: Fri, 1 Jul 2005 23:58:23 +0000 (UTC), Mark Stosberg <suppressed> wrote:
> Hello,
> 
> Since I know there are a lot of a ValidateRM users here, I'd like to
> post here for feedback on my proposed DFV 4.0 release, a major update.
> 
> I asked first on the DFV list, but was practically warnocked.
> 
> I'm depending on some feedback to decide how to proceed with the
> release. Thanks!

Cool. 

I had found that Data::FormValidator::Constraints::Upload
wouldn't work with CGI::Simple because it depends on the tmpFileName
meth which Simple doesn't have. My temporary solution was to make my
own subclass of it with the intention of sending a patch later. The
change is just a couple of lines.

This:
    my $tmp_file = $q->tmpFileName($q->param($field)) || 
	 (warn "$0: can't find tmp file for field named $field" and return undef);

becomes:

  if ($q->UNIVERSAL::can("tmpFileName")) {
    my $tmp_file = $q->tmpFileName($q->param($field)) || 
      (warn "$0: can't find tmp file for field named $field" and return undef);
    $fm_mt = $mm->checktype_filename($tmp_file);
  } else {
    my $fh = $q->upload( $q->param($field) );
    $fm_mt = $mm->checktype_filehandle($fh) || 
      (warn "$0: can't get filehandle for field named $field" and return undef);
  }

Also, I had fixed the mistake further down where the returned mime info used
$uploaded_mt instead of $mt, but I see that's fixed in the new version.

I could send a patch if you like, but it will be a few days before I can get
to it.

Regards,
David Emery
suppressed


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.