File Coverage

blib/lib/CGI/Test/Form/Widget/Input/File.pm
Criterion Covered Total %
statement 13 15 86.6
branch n/a
condition n/a
subroutine 5 7 71.4
pod 3 3 100.0
total 21 25 84.0


line stmt bran cond sub pod time code
1             package CGI::Test::Form::Widget::Input::File;
2 14     14   45 use strict;
  14         17  
  14         424  
3 14     14   45 use warnings;
  14         76  
  14         340  
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     14   43 use Carp;
  14         11  
  14         548  
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     14   293 use base qw(CGI::Test::Form::Widget::Input::Text_Field);
  14         10  
  14         1269  
26              
27             #
28             # Attribute access
29             #
30              
31             sub gui_type
32             {
33 0     0 1 0 return "file upload";
34             }
35              
36             #
37             # Redefined predicates
38             #
39              
40             sub is_field
41             {
42 0     0 1 0 return 0;
43             } # not a pure text field
44              
45             sub is_file
46             {
47 19     19 1 102 return 1;
48             }
49              
50             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.
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 Ftokarev@cpan.orgE>.
80              
81             =head1 SEE ALSO
82              
83             CGI::Test::Form::Widget::Input(3).
84              
85             =cut
86