Changeset 68

Show
Ignore:
Timestamp:
11/25/09 00:37:32 (4 years ago)
Author:
clinton
Message:

Bless synthetic handle for small files to be an IO::Handle, so that the interface is consistent, tid10737 tid10892

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/Mungo/MultipartFormData.pm

    r67 r68  
    1010use File::Temp; 
    1111use IO::File; 
     12use Data::Dumper; 
    1213eval "use Apache2::RequestIO;"; 
    1314 
     
    3637                if (exists($part->{payload}) && !exists($part->{handle})) { 
    3738                    # So we have a payload, but not a handle?  Must have been a small file. 
     39 
    3840                    # Create a new IO::Handle by opening the payload "in memory" 
    3941                    # See perldoc -f open and perldoc perliol 
    40                     open($part->{handle}, "<", \$part->{payload}); 
     42                    # I would MUCH rather use IO::Scalar for this - it's much saner and more clear 
     43                    open($part->{handle}, "<", \$part->{payload}); # just threw up in my mouth a little 
     44                    bless $part->{handle}, 'IO::Handle'; # just threw up in my mouth a lot 
    4145                    delete $part->{payload}; 
    4246                } 
     
    201205            delete $self->{payload}; 
    202206 
    203             # Next time we append, since we have $self->{handle}, we'll print imemdiately. 
     207            # Next time we append, since we have $self->{handle}, we'll print immediately. 
    204208        } 
    205209    }