| 1 | package HTML::Form::FileInput; | ||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | 11 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | 11 | ▶ | use parent 'HTML::Form::TextInput'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||
| 6 | 11 | our $VERSION = '6.13'; | |||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||
| 8 | # ABSTRACT: An HTML form file input element for use with HTML::Form | ||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||
| 10 | 32 | ▶ | sub file { | ||||||||||||||||||||||||||||||
|
Subroutine
file: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 11 | 32 | my $self = shift; | |||||||||||||||||||||||||||||||
| 12 | 32 | $self->value(@_); | |||||||||||||||||||||||||||||||
| 13 | } | ||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||
| 15 | 16 | ▶ | sub filename { | ||||||||||||||||||||||||||||||
|
Subroutine
filename: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 16 | 16 | my $self = shift; | |||||||||||||||||||||||||||||||
| 17 | 16 | my $old = $self->{filename}; | |||||||||||||||||||||||||||||||
| 18 | 16 | ▶ | $self->{filename} = shift if @_; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 19 | 16 | ▶ | $old = $self->file unless defined $old; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 20 | 16 | $old; | |||||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||
| 23 | 15 | ▶ | sub content { | ||||||||||||||||||||||||||||||
|
Subroutine
content: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 24 | 15 | my $self = shift; | |||||||||||||||||||||||||||||||
| 25 | 15 | my $old = $self->{content}; | |||||||||||||||||||||||||||||||
| 26 | 15 | ▶ | $self->{content} = shift if @_; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 27 | 15 | $old; | |||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||
| 30 | 13 | ▶ | sub headers { | ||||||||||||||||||||||||||||||
|
Subroutine
headers: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 31 | 13 | my $self = shift; | |||||||||||||||||||||||||||||||
| 32 | 13 | ▶ | my $old = $self->{headers} || []; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'headers'} || []
MC/DC0%0/1
$self->{'headers'} || []
$self->{'headers'}
Truth table50%1/2
A
A= $self->{'headers'}
| |||||||||||||||||||||||||||||||||
| 33 | 13 | ▶ | $self->{headers} = [@_] if @_; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 34 | 13 | @$old; | |||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||
| 37 | 14 | ▶ | sub form_name_value { | ||||||||||||||||||||||||||||||
|
Subroutine
form_name_value: called CC=11 SCAR=24.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 38 | 14 | my ( $self, $form ) = @_; | |||||||||||||||||||||||||||||||
| 39 | 14 | ▶ | return $self->SUPER::form_name_value($form) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$form->method ne "POST" or $form->enctype ne "multipart/form-data"
MC/DC50%1/2
$form->method ne "POST" or $form->enctype ne "multipart/form-data"
$form->method ne "POST"
$form->enctype ne "multipart/form-data"
Truth table66%2/3
A or B
A= $form->method ne "POST"B= $form->enctype ne "multipart/form-data"
| |||||||||||||||||||||||||||||||||
| 40 | if $form->method ne "POST" | ||||||||||||||||||||||||||||||||
| 41 | || $form->enctype ne "multipart/form-data"; | ||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||
| 43 | 13 | my $name = $self->name; | |||||||||||||||||||||||||||||||
| 44 | 13 | ▶ | return unless defined $name; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 45 | 13 | ▶ | return if $self->{disabled}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||
| 47 | 13 | my $file = $self->file; | |||||||||||||||||||||||||||||||
| 48 | 13 | my $filename = $self->filename; | |||||||||||||||||||||||||||||||
| 49 | 13 | my @headers = $self->headers; | |||||||||||||||||||||||||||||||
| 50 | 13 | my $content = $self->content; | |||||||||||||||||||||||||||||||
| 51 | 13 | my %headers = @headers; | |||||||||||||||||||||||||||||||
| 52 | 13 | ▶ | if ( defined $content || grep m/^Content$/i, keys %headers ) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
defined $content or grep /^Content$/i, keys %headers
MC/DC50%1/2
defined $content or grep /^Content$/i, keys %headers
defined $content
grep /^Content$/i, keys %headers
Truth table66%2/3
A or B
A= defined $contentB= grep /^Content$/i, keys %headers
| |||||||||||||||||||||||||||||||||
| 53 | 2 | ▶ | $filename = $file unless defined $filename; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 54 | 2 | $file = undef; | |||||||||||||||||||||||||||||||
| 55 | 2 | unshift( @headers, "Content" => $content ); | |||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||
| 57 | ▶ | elsif ( !defined($file) || length($file) == 0 ) { | |||||||||||||||||||||||||||||||
|
Condition66%2/3
not defined $file or length $file == 0
MC/DC50%1/2
not defined $file or length $file == 0
not defined $file
length $file == 0
Truth table66%2/3
not(A) or B
A= not defined $fileB= length $file == 0
| |||||||||||||||||||||||||||||||||
| 58 | 1 | return; | |||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||
| 61 | # legacy (this used to be the way to do it) | ||||||||||||||||||||||||||||||||
| 62 | 12 | ▶ | if ( ref($file) eq "ARRAY" ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 63 | 7 | my $f = shift @$file; | |||||||||||||||||||||||||||||||
| 64 | 7 | my $fn = shift @$file; | |||||||||||||||||||||||||||||||
| 65 | 7 | push( @headers, @$file ); | |||||||||||||||||||||||||||||||
| 66 | 7 | $file = $f; | |||||||||||||||||||||||||||||||
| 67 | 7 | $filename = $fn; | |||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||
| 70 | 12 | return ( $name => [ $file, $filename, @headers ] ); | |||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||
| 73 | 11 | 1; | |||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||
| 75 | __END__ | ||||||||||||||||||||||||||||||||