---
name: "CGI::Test::Form::Widget::Input"
section: "3pm"
platform: "linux"
package: "libcgi-test-perl"
version: "1.111-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/CGI::Test::Form::Widget::Input"
---

# CGI::Test::Form::Widget::Input(3pm)

Abstract representation of an input field

## NAME

CGI::Test::Form::Widget::Input - Abstract representation of an input field

## SYNOPSIS

```
 # Inherits from CGI::Test::Form::Widget
```

## DESCRIPTION

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

## INTERFACE

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.

- "clear"

  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:

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

## AUTHORS

The original author is Raphael Manfredi.

Steven Hilton was long time maintainer of this module.

Current maintainer is Alexander Tokarev *\<tokarev@cpan.org\>*.

## SEE ALSO

**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).
