CGI-Test
view release on metacpan or search on metacpan
lib/CGI/Test/Form/Widget/Input.pm view on Meta::CPAN
&{$filter};
$this->set_value($_);
}
#
# Attribute access
#
sub is_read_only
{
my $this = shift;
return $this->{is_read_only};
}
#
# High-level classification predicates
#
sub is_input
{
return 1;
}
#
# Predicates for the Input hierarchy
#
sub is_field
{
return 0;
}
sub is_area
{
return 0;
}
sub is_password
{
return 0;
}
sub is_file
{
return 0;
}
1;
=head1 NAME
CGI::Test::Form::Widget::Input - Abstract representation of an input field
=head1 SYNOPSIS
# Inherits from CGI::Test::Form::Widget
=head1 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
C<prepend()>, C<append()>, C<replace()>, C<clear()> or even run existing text
through C<filter()>.
=head1 INTERFACE
The interface is the same as the one described in L<CGI::Test::Form::Widget>,
with the following additions:
=head2 Attribute Setting
There are a number of convenience routines that are wrappers on C<set_value()>:
=over 4
=item C<append> I<string>
Appends the I<string> text to the existing text.
=item C<clear>
Clears existing text.
=item C<filter> I<filter_routine>
Runs existing text through the given I<filter_routine>. The C<$_> 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 C<this> by C<that> within the input text.
=item C<prepend> I<string>
Prepends the I<string> text to the existing text.
=item C<replace> I<string>
Replaces the existing text with I<string>.
=back
=head2 Widget Classification Predicates
There are additional predicates to distinguish between the various
input fields:
=over 4
=item C<is_area>
Returns I<true> for a text area.
=item C<is_field>
Returns I<true> for a pure text field.
=item C<is_file>
Returns I<true> for a file upload field (text field with browser support for
file selection).
=item C<is_password>
Returns I<true> for a password field (text field with input masked by GUI).
=back
=head1 AUTHORS
The original author is Raphael Manfredi.
Steven Hilton was long time maintainer of this module.
Current maintainer is Alexander Tokarev F<E<lt>tokarev@cpan.orgE<gt>>.
=head1 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).
=cut
( run in 1.469 second using v1.01-cache-2.11-cpan-b16cb0d3907 )