| 1 | package CGI::Test::Form::Widget::Input::Text_Area; | ||
| 2 | 14 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 14 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | ################################################################## | ||
| 5 | # $Id: Text_Area.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 | ▶ | use Carp; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | |||
| 17 | # | ||
| 18 | # This class models a FORM textarea input field. | ||
| 19 | # | ||
| 20 | |||
| 21 | 14 | ▶ | use base qw(CGI::Test::Form::Widget::Input); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 22 | |||
| 23 | # | ||
| 24 | # %attr | ||
| 25 | # | ||
| 26 | # Defines which HTML attributes we should look at within the node, and how | ||
| 27 | # to translate that into class attributes. | ||
| 28 | # | ||
| 29 | |||
| 30 | 14 | my %attr = ('name' => 'name', | |
| 31 | 'value' => 'value', | ||
| 32 | 'rows' => 'rows', | ||
| 33 | 'cols' => 'columns', | ||
| 34 | 'wrap' => 'wrap_mode', | ||
| 35 | 'disabled' => 'is_disabled', | ||
| 36 | 'readonly' => 'is_read_only', | ||
| 37 | ); | ||
| 38 | |||
| 39 | # | ||
| 40 | # ->_init | ||
| 41 | # | ||
| 42 | # Per-widget initialization routine. | ||
| 43 | # Parse HTML node to determine our specific parameters. | ||
| 44 | # | ||
| 45 | sub _init | ||
| 46 | 16 | ▶ | { |
|
Subroutine
_init: called CC=1 SCAR=0.0
| |||
| 47 | 16 | my $this = shift; | |
| 48 | 16 | my ($node) = shift; | |
| 49 | 16 | $this->_parse_attr($node, \%attr); | |
| 50 | 16 | return; | |
| 51 | } | ||
| 52 | |||
| 53 | # | ||
| 54 | # Attribute access | ||
| 55 | # | ||
| 56 | ############################################################ | ||
| 57 | sub rows | ||
| 58 | 0 | ▶ | { |
|
Subroutine
rows: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 59 | 0 | my $this = shift; | |
| 60 | 0 | return $this->{rows}; | |
| 61 | } | ||
| 62 | ############################################################ | ||
| 63 | sub columns | ||
| 64 | 0 | ▶ | { |
|
Subroutine
columns: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 65 | 0 | my $this = shift; | |
| 66 | 0 | return $this->{columns}; | |
| 67 | } | ||
| 68 | ############################################################ | ||
| 69 | sub wrap_mode | ||
| 70 | 0 | ▶ | { |
|
Subroutine
wrap_mode: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 71 | 0 | my $this = shift; | |
| 72 | 0 | return $this->{wrap_mode}; | |
| 73 | } | ||
| 74 | ############################################################ | ||
| 75 | |||
| 76 | sub gui_type | ||
| 77 | 0 | ▶ | { |
|
Subroutine
gui_type: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 78 | 0 | "text area" | |
| 79 | } | ||
| 80 | |||
| 81 | # | ||
| 82 | # Redefined predicates | ||
| 83 | # | ||
| 84 | |||
| 85 | ############################################################ | ||
| 86 | sub is_area | ||
| 87 | 0 | ▶ | { |
|
Subroutine
is_area: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 88 | 0 | 1 | |
| 89 | } | ||
| 90 | |||
| 91 | 14 | 1; | |
| 92 | |||
| 93 | =head1 NAME | ||
| 94 | |||
| 95 | CGI::Test::Form::Widget::Input::Text_Area - A text area | ||
| 96 | |||
| 97 | =head1 SYNOPSIS | ||
| 98 | |||
| 99 | # Inherits from CGI::Test::Form::Widget::Input | ||
| 100 | # $form is a CGI::Test::Form | ||
| 101 | |||
| 102 | my $comments = $form->input_by_name("comments"); | ||
| 103 | $comments->append(<<EOM); | ||
| 104 | -- | ||
| 105 | There's more than one way to do it. | ||
| 106 | --Larry Wall | ||
| 107 | EOM | ||
| 108 | |||
| 109 | =head1 DESCRIPTION | ||
| 110 | |||
| 111 | This class models a text area, where users can type text. | ||
| 112 | |||
| 113 | =head1 INTERFACE | ||
| 114 | |||
| 115 | The interface is the same as the one described in | ||
| 116 | L<CGI::Test::Form::Widget::Input>, with the following additional attributes: | ||
| 117 | |||
| 118 | =over 4 | ||
| 119 | |||
| 120 | =item C<columns> | ||
| 121 | |||
| 122 | Amount of displayed columns. | ||
| 123 | |||
| 124 | =item C<rows> | ||
| 125 | |||
| 126 | Amount of displayed text rows. | ||
| 127 | |||
| 128 | =item C<wrap_mode> | ||
| 129 | |||
| 130 | The selected work wrapping mode. | ||
| 131 | |||
| 132 | =back | ||
| 133 | |||
| 134 | =head1 BUGS | ||
| 135 | |||
| 136 | Does not handle C<wrap_mode> and C<columns> yet. There is actually some work | ||
| 137 | done by the browser when the wrapping mode is set to C<"hard">, which alters | ||
| 138 | the value transmitted back to the script upon submit. | ||
| 139 | |||
| 140 | =head1 AUTHORS | ||
| 141 | |||
| 142 | The original author is Raphael Manfredi. | ||
| 143 | |||
| 144 | Steven Hilton was long time maintainer of this module. | ||
| 145 | |||
| 146 | Current maintainer is Alexander Tokarev F<E<lt>tokarev@cpan.orgE<gt>>. | ||
| 147 | |||
| 148 | =head1 SEE ALSO | ||
| 149 | |||
| 150 | CGI::Test::Form::Widget::Input(3). | ||
| 151 | |||
| 152 | =cut | ||
| 153 | |||