CGI::Test::Form::Widget::Input - Abstract representation of an input field
# Inherits from CGI::Test::Form::Widget
This class is the abstract representation of a text input field, i.e. a text field, a password field, a file upload field or a text area.
To simulate user input in those fields, there are a set of routines to prepend(), append(), replace(), clear() or even run existing text through filter().
prepend()
append()
replace()
clear()
filter()
The interface is the same as the one described in CGI::Test::Form::Widget, with the following additions:
There are a number of convenience routines that are wrappers on set_value():
set_value()
append
Appends the string text to the existing text.
clear
Clears existing text.
filter
Runs existing text through the given filter_routine. The $_ variable is set to the whole text value, and is made available to the filter. Hence you may write:
$_
$input->filter(sub { s/this/that/g });
to replace all instances of this by that within the input text.
this
that
prepend
Prepends the string text to the existing text.
replace
Replaces the existing text with string.
There are additional predicates to distinguish between the various input fields:
is_area
Returns true for a text area.
is_field
Returns true for a pure text field.
is_file
Returns true for a file upload field (text field with browser support for file selection).
is_password
Returns true for a password field (text field with input masked by GUI).
The original author is Raphael Manfredi.
Steven Hilton was long time maintainer of this module.
Current maintainer is Alexander Tokarev <tokarev@cpan.org>.
CGI::Test::Form::Widget(3), CGI::Test::Form::Widget::Input::File(3), CGI::Test::Form::Widget::Input::Password(3), CGI::Test::Form::Widget::Input::Text_Area(3), CGI::Test::Form::Widget::Input::Text_Field(3).
To install CGI::Test, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CGI::Test
CPAN shell
perl -MCPAN -e shell install CGI::Test
For more information on module installation, please visit the detailed CPAN module installation guide.