[Catalyst] Where is the form field lost?

Bill Moseley moseley at hank.org
Sun Jan 24 19:56:53 GMT 2010

On Sun, Jan 24, 2010 at 8:31 AM, Octavian Rasnita <orasnita at gmail.com>wrote:
>> Give your upload field(s) a name like "upload_1"  and then see if it
>> exists
>> in uploads.
> I gave it the name "file", but if the file is not uploaded, it doesn't
> appear in uploads(). (I hope "file" is OK as a name, no?)

Why do you need to know that a field existed on the form but was submitted
empty?  Checkboxes don't submit if not checked.  You get what's included in
the post and have to work from that.  Either you have an upload or not,

Aha, so I should look better in HTTP::Body.

Is there a reason it does that? (Leaves alone all other empty form fields
> but deletes the empty file upload fields?)

Without commends in the code or documentation can't really know the author's
reasoning.   I guess it assume uploads go to temp files and no need to do
that if there's no content.

(IIRC, I thought "filename" was optional, but maybe I'm mistaken.)

I'm kind of curious why it does this:

    if ( $part->{fh} && ( my $length =3D length( $part->{data} ) ) ) {
        $part->{fh}->write( substr( $part->{data}, 0, $length, '' ), $length

instead of:

    print $part->{fh} $part->{data} if $part->{fh};

Maybe for fear of line ending conversion??

-- =

Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20100124/2c46a=

More information about the Catalyst mailing list