Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Catalyst::Request::Upload inside-out-object weirdness

by andye (Curate)
on Mar 26, 2010 at 15:27 UTC ( #831179=note: print w/ replies, xml ) Need Help??


in reply to Catalyst::Request::Upload inside-out-object weirdness

It looks as though maybe in Catalyst::Engine::prepare_uploads, this:

my $headers = HTTP::Headers->new( %{ $upload->{headers} } +); my $u = Catalyst::Request::Upload->new ( size => $upload->{size}, type => $headers->content_type, headers => $headers, tempname => $upload->{tempname}, filename => $upload->{filename}, );

is somehow creating this:

uploads => { SourceFile_1 => bless({ "/tmp/J8OcVSq1Kq" => "filename", "HTTP::Headers=HASH(0x40ec828)" => "temp +name", "aaa.jpg" => undef, "charset=utf-8; Content-Transfer-Encodin +g: binary" => "headers", size => 374205, type => "image/jpeg", }, "Catalyst::Request::Upload"), },

which seems to suggest maybe the problem is with HTTP::Headers...


Comment on Re: Catalyst::Request::Upload inside-out-object weirdness
Select or Download Code
Replies are listed 'Best First'.
Re^2: Catalyst::Request::Upload inside-out-object weirdness
by andye (Curate) on Mar 26, 2010 at 15:57 UTC
Re^2: Catalyst::Request::Upload inside-out-object weirdness
by JavaFan (Canon) on Mar 26, 2010 at 16:23 UTC
    which seems to suggest maybe the problem is with HTTP::Headers.
    Doubtful. To me, it seems the mistake is in the call to Catalyst::Request::Upload. It assumes that the call to $headers->content_type returns one value (or another odd amount) when called in list context. But that assumption is false; it may return an even number of values as well.

    It looks to be that something like

    type => ($headers->content_type)[0],
    is an improvement.
      yeah, amended to type => scalar($headers->content_type) for next release, thanks to Florian Ragwitz @ Catalyst for quick response.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://831179]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (11)
As of 2015-07-08 00:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls