Jifty/Web/Form/Field/Upload.pm untested

filter: Statementstmt 0.0% 0 / 19 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 28 CC 1 SCAR 6.9
CC
1
Cov
0%
render_widget
2.0
render_value
2.0
classes
2.0
CRAP 2.0
1 use warnings;
2 use strict;
3
4 package Jifty::Web::Form::Field::Upload;
5  
6 =head1 NAME
7  
8 Jifty::Web::Form::Field::Upload - File upload field
9  
10 =head1 DESCRIPTION
11  
12 An input field that renders using C<< <input type="file" /> >>. The
13 argument value that the action receives from this field via
14 L<Jifty::Action/argument_value> will be a filehandle, which can be
15 read in the usual ways.
16  
17 =cut
18  
19 use base qw/Jifty::Web::Form::Field/;
20  
21 =head2 render_widget
22  
23 Renders the file upload widget.
24  
25 =cut
26  
27 sub render_widget {
28 my $self = shift;
29 my $field = qq!<input type="file" name="@{[ $self->input_name ]}" !;
30 $field .= $self->_widget_class();
31 $field .= $self->javascript;
32 $field .= qq!/>!;
33 Jifty->web->out($field);
34 '';
35 }
36  
37  
38 =head2 render_value
39  
40 The 'value', rendered, is empty so that BLOBs and the like don't get
41 streamed to the browser.
42  
43 =cut
44  
45 sub render_value {
46 '';
47 }
48  
49 =head2 classes
50  
51 Add 'upload' to the rest of the classes
52  
53 =cut
54  
55 sub classes {
56 my $self = shift;
57 return join(' ', 'upload', ($self->SUPER::classes));
58 }
59  
60 1;