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

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

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

in reply to Re^3: Catalyst::Request::Upload inside-out-object weirdness
in thread Catalyst::Request::Upload inside-out-object weirdness

Right. I don't assign the hash. It happens inside Catalyst.

Looking at the source, it looks like it happens in Catalyst::Engine::prepare_uploads, which reads

sub prepare_uploads { my ( $self, $c ) = @_; my $request = $c->request; return unless $request->_body; my $uploads = $request->_body->upload; my $parameters = $request->parameters; foreach my $name (keys %$uploads) { my $files = $uploads->{$name}; my @uploads; for my $upload (ref $files eq 'ARRAY' ? @$files : ($files)) { 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}, ); push @uploads, $u; } $request->uploads->{$name} = @uploads > 1 ? \@uploads : $uploa +ds[0]; # support access to the filename as a normal param my @filenames = map { $_->{filename} } @uploads; # append, if there's already params with this name if (exists $parameters->{$name}) { if (ref $parameters->{$name} eq 'ARRAY') { push @{ $parameters->{$name} }, @filenames; } else { $parameters->{$name} = [ $parameters->{$name}, @filena +mes ]; } } else { $parameters->{$name} = @filenames > 1 ? \@filenames : $fil +enames[0]; } } }

Replies are listed 'Best First'.
Re^5: Catalyst::Request::Upload inside-out-object weirdness
by ikegami (Pope) on Mar 26, 2010 at 15:18 UTC
    Looks like
    can return more than one value. Replace it with

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://831172]
Corion had a meeting with some startup today. They have a very interesting DB proxy product, but their tech stack is really, really weird. They use the Pg wire protocol but not the Pg libraries to handle it. They support Pg SQL syntax, but don't use ...
[Corion]: ... the Pg parser (or so they claim).
[Corion]: Also, they rolled their own user management instead of supporting LDAP for user/role management, but that just shows that they're new in the enterprise market :)
Corion also just now realizes they didn't leave business cards.

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2018-04-19 12:17 GMT
Find Nodes?
    Voting Booth?