On 2005-07-02, David Emery <suppressed> wrote:
>
> 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);
> }
This is an improvement, but assumes that a non-CGI object is a
CGI::Simple object. Not perfect, but better.
> I could send a patch if you like, but it will be a few days before I can get
> to it.
I'll wait. :)
Mark
--
http://mark.stosberg.com/
---------------------------------------------------------------------
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.