| 1 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | |||||||||||
| 3 | package HTML::FormFu::QueryType::CGI::Simple; | ||||||||||
| 4 | 1 | $HTML::FormFu::QueryType::CGI::Simple::VERSION = '2.09'; | |||||||||
| 5 | # ABSTRACT: uploaded file | ||||||||||
| 6 | |||||||||||
| 7 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 1 | extends 'HTML::FormFu::QueryType::CGI'; | |||||||||
| 10 | |||||||||||
| 11 | 0 | ▶ | sub parse_uploads { | ||||||||
|
Subroutine
parse_uploads: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||
| 12 | 0 | my ( $class, $form, $name ) = @_; | |||||||||
| 13 | |||||||||||
| 14 | 0 | my $query = $form->query; | |||||||||
| 15 | 0 | my @params = $query->param($name); | |||||||||
| 16 | 0 | my @new; | |||||||||
| 17 | |||||||||||
| 18 | 0 | for my $param (@params) { | |||||||||
| 19 | 0 | ▶ | if ( my $file = $query->upload($param) ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | 0 | my $filename = $param; | |||||||||
| 21 | |||||||||||
| 22 | 0 | $param = $class->new( | |||||||||
| 23 | { _param => $file, | ||||||||||
| 24 | filename => $filename, | ||||||||||
| 25 | parent => $form, | ||||||||||
| 26 | } ); | ||||||||||
| 27 | |||||||||||
| 28 | 0 | my $headers = HTTP::Headers->new( | |||||||||
| 29 | 'Content-Type' => $query->upload_info( $filename, 'mime' ), | ||||||||||
| 30 | 'Content-Length' => $query->upload_info( $filename, 'size' ), | ||||||||||
| 31 | ); | ||||||||||
| 32 | |||||||||||
| 33 | 0 | $param->headers($headers); | |||||||||
| 34 | 0 | $param->size( $headers->content_length ); | |||||||||
| 35 | 0 | $param->type( $headers->content_type ); | |||||||||
| 36 | } | ||||||||||
| 37 | 0 | push @new, $param; | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 0 | ▶ | return if !@new; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 41 | |||||||||||
| 42 | 0 | ▶ | return @new == 1 ? $new[0] : \@new; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | 0 | ▶ | sub fh { | ||||||||
|
Subroutine
fh: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 46 | 0 | my ($self) = @_; | |||||||||
| 47 | |||||||||||
| 48 | 0 | return $self->form->query->upload( $self->filename ); | |||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||
| 52 | |||||||||||
| 53 | 1 | 1; | |||||||||
| 54 | |||||||||||
| 55 | __END__ | ||||||||||