blib/lib/CatalystX/Resource/TraitFor/Controller/Resource/MergeUploadParams.pm untested

filter: Statementstmt 0.0% 0 / 16 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 2 Podpod n/a totaltotal 0.0% 0 / 20 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package CatalystX::Resource::TraitFor::Controller::Resource::MergeUploadParams;
2 $CatalystX::Resource::TraitFor::Controller::Resource::MergeUploadParams::VERSION = '0.009_002';
3 use MooseX::MethodAttributes::Role;
4 use namespace::autoclean;
5  
6 # ABSTRACT: merge upload params into request params
7  
8 requires qw/
9 form
10 /;
11  
12  
13 before 'form' => sub {
14 my ( $self, $c, $activate_fields ) = @_;
15  
16 # for each upload put the Catalyst::Request::Upload object into $params
17 if ( $c->req->method eq 'POST' ) {
18 while (my ($param_name, $upload) = each %{$c->req->uploads}) {
19 $c->req->params->{$param_name} = $upload;
20 }
21 }
22 };
23  
24 1;
25  
26 __END__
27  
28 =pod
29  
30 =encoding UTF-8
31  
32 =head1 NAME
33  
34 CatalystX::Resource::TraitFor::Controller::Resource::MergeUploadParams - merge upload params into request params
35  
36 =head1 VERSION
37  
38 version 0.009_002
39  
40 =head1 METHOD MODIFIERS
41  
42 =head2 before 'form'
43  
44 merge $c->req->uploads into $c->req->params
45  
46 Makes Catalyst::Request::Upload objects available in
47 HTML::FormHandler::params
48  
49 You might need this if you are using HTML::FormHandler
50 and DBIx::Class::InflateColumn::FS
51  
52 =head1 AUTHOR
53  
54 David Schmidt <davewood@cpan.org>
55  
56 =head1 COPYRIGHT AND LICENSE
57  
58 This software is copyright (c) 2011 by David Schmidt.
59  
60 This is free software; you can redistribute it and/or modify it under
61 the same terms as the Perl 5 programming language system itself.
62  
63 =cut