Scroll to navigation

CGI::Test::Form::Widget::Input(3pm) User Contributed Perl Documentation CGI::Test::Form::Widget::Input(3pm)


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()".


The interface is the same as the one described in CGI::Test::Form::Widget, with the following additions:

Attribute Setting

There are a number of convenience routines that are wrappers on "set_value()":
"append" string
Appends the string text to the existing text.
Clears existing text.
"filter" filter_routine
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.

"prepend" string
Prepends the string text to the existing text.
"replace" string
Replaces the existing text with string.

Widget Classification Predicates

There are additional predicates to distinguish between the various input fields:
Returns true for a text area.
Returns true for a pure text field.
Returns true for a file upload field (text field with browser support for file selection).
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 <>.


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).
2021-01-08 perl v5.32.0