Test/Form/Widget/Input/File.pm

filter: Statementstmt 87.5% 14 / 16 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 5 / 7 Podpod 100% 3 / 3 totaltotal 84.6% 22 / 26 CC 1 SCAR 2.5
CC
1
Cov
88%
gui_type
2.0
is_field
2.0
BEGIN
1.0
CRAP 1.3
« Test/Form/Widget/Input.pm ↑ Summary Test/Form/Widget/Menu/List.pm »
1 package CGI::Test::Form::Widget::Input::File;
2 14 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 14 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 ##################################################################
5 # $Id: File.pm 411 2011-09-26 11:19:30Z nohuhu@nohuhu.org $
6 # $Name: cgi-test_0-104_t1 $
7 ##################################################################
8 #
9 # Copyright (c) 2001, Raphael Manfredi
10 #
11 # You may redistribute only under the terms of the Artistic License,
12 # as specified in the README file that comes with the distribution.
13 #
14  
15 14 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 #
18 # This class models a FORM file input for uploading.
19 #
20 # It inherits from Text_Field, since the only distinction between a text field
21 # and a file upload field is the presence of the "browse" button displayed by
22 # the browser to select a file.
23 #
24  
25 14 ▶use base qw(CGI::Test::Form::Widget::Input::Text_Field);
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 #
28 # Attribute access
29 #
30  
31 sub gui_type
32 0 ▶{
Subroutine gui_type: not called CC=1 SCAR=6.9
Pod documented
33 0 return "file upload";
34 }
35  
36 #
37 # Redefined predicates
38 #
39  
40 sub is_field
41 0 ▶{
Subroutine is_field: not called CC=1 SCAR=6.9
Pod documented
42 0 return 0;
43 } # not a pure text field
44  
45 sub is_file
46 19 ▶{
Subroutine is_file: called CC=1 SCAR=0.0
Pod documented
47 19 return 1;
48 }
49  
50 14 1;
51  
52 =head1 NAME
53  
54 CGI::Test::Form::Widget::Input::File - A file upload control
55  
56 =head1 SYNOPSIS
57  
58 # Inherits from CGI::Test::Form::Widget::Input
59 # $form is a CGI::Test::Form
60  
61 my $upload = $form->input_by_name("upload");
62 $upload->replace("/tmp/file");
63  
64 =head1 DESCRIPTION
65  
66 This class models a file upload control, which is a text field to enter
67 a file name, with a little "browse" control button nearby that allows
68 the user to select a file via a GUI...
69  
70 The interface is the same as the one described in
71 L<CGI::Test::Form::Widget::Input::Text_Field>.
72  
73 =head1 AUTHORS
74  
75 The original author is Raphael Manfredi.
76  
77 Steven Hilton was long time maintainer of this module.
78  
79 Current maintainer is Alexander Tokarev F<E<lt>tokarev@cpan.orgE<gt>>.
80  
81 =head1 SEE ALSO
82  
83 CGI::Test::Form::Widget::Input(3).
84  
85 =cut
86  
« Test/Form/Widget/Input.pm ↑ Summary Test/Form/Widget/Menu/List.pm »