line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
15
|
|
|
15
|
|
6692
|
use strict; |
|
15
|
|
|
|
|
23
|
|
|
15
|
|
|
|
|
470
|
|
2
|
15
|
|
|
15
|
|
58
|
use warnings; |
|
15
|
|
|
|
|
17
|
|
|
15
|
|
|
|
|
592
|
|
3
|
|
|
|
|
|
|
package HTML::Widget::Plugin::Textarea; |
4
|
|
|
|
|
|
|
# ABSTRACT: a widget for a large text entry box |
5
|
|
|
|
|
|
|
$HTML::Widget::Plugin::Textarea::VERSION = '0.203'; |
6
|
15
|
|
|
15
|
|
59
|
use parent 'HTML::Widget::Plugin'; |
|
15
|
|
|
|
|
24
|
|
|
15
|
|
|
|
|
66
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
9
|
|
|
|
|
|
|
#pod |
10
|
|
|
|
|
|
|
#pod $widget_factory->textarea({ |
11
|
|
|
|
|
|
|
#pod id => 'elem-id', # also used as control name, if no name given |
12
|
|
|
|
|
|
|
#pod value => $big_hunk_of_text, |
13
|
|
|
|
|
|
|
#pod }); |
14
|
|
|
|
|
|
|
#pod |
15
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
16
|
|
|
|
|
|
|
#pod |
17
|
|
|
|
|
|
|
#pod This plugin provides a text-entry area widget. |
18
|
|
|
|
|
|
|
#pod |
19
|
|
|
|
|
|
|
#pod The C attribute may be used to add a default class to every |
20
|
|
|
|
|
|
|
#pod produced input. This class cannot be overridden. |
21
|
|
|
|
|
|
|
#pod |
22
|
|
|
|
|
|
|
#pod my $plugin = HTML::Widget::Factory::Input->new({ |
23
|
|
|
|
|
|
|
#pod default_classes => [ qw(foo bar) ], |
24
|
|
|
|
|
|
|
#pod }); |
25
|
|
|
|
|
|
|
#pod |
26
|
|
|
|
|
|
|
#pod =head1 METHODS |
27
|
|
|
|
|
|
|
#pod |
28
|
|
|
|
|
|
|
#pod =head2 C< provided_widgets > |
29
|
|
|
|
|
|
|
#pod |
30
|
|
|
|
|
|
|
#pod This plugin provides the following widgets: textarea |
31
|
|
|
|
|
|
|
#pod |
32
|
|
|
|
|
|
|
#pod =cut |
33
|
|
|
|
|
|
|
|
34
|
17
|
|
|
17
|
1
|
36
|
sub provided_widgets { qw(textarea) } |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
#pod =head2 C< textarea > |
37
|
|
|
|
|
|
|
#pod |
38
|
|
|
|
|
|
|
#pod This method returns a text-entry area widget. |
39
|
|
|
|
|
|
|
#pod |
40
|
|
|
|
|
|
|
#pod In addition to the generic L attributes, the following |
41
|
|
|
|
|
|
|
#pod are valid arguments: |
42
|
|
|
|
|
|
|
#pod |
43
|
|
|
|
|
|
|
#pod =over |
44
|
|
|
|
|
|
|
#pod |
45
|
|
|
|
|
|
|
#pod =item disabled |
46
|
|
|
|
|
|
|
#pod |
47
|
|
|
|
|
|
|
#pod If true, this option indicates that the widget can't be changed by the user. |
48
|
|
|
|
|
|
|
#pod |
49
|
|
|
|
|
|
|
#pod =item value |
50
|
|
|
|
|
|
|
#pod |
51
|
|
|
|
|
|
|
#pod If this argument is given and defined, the widget will be initially populated |
52
|
|
|
|
|
|
|
#pod by its value. |
53
|
|
|
|
|
|
|
#pod |
54
|
|
|
|
|
|
|
#pod =back |
55
|
|
|
|
|
|
|
#pod |
56
|
|
|
|
|
|
|
#pod =cut |
57
|
|
|
|
|
|
|
|
58
|
15
|
|
|
15
|
|
1101
|
use HTML::Element; |
|
15
|
|
|
|
|
22
|
|
|
15
|
|
|
|
|
121
|
|
59
|
|
|
|
|
|
|
|
60
|
17
|
|
|
17
|
|
52
|
sub _attribute_args { qw(disabled id) } |
61
|
34
|
|
|
34
|
|
70
|
sub _boolean_args { qw(disabled) } |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub textarea { |
64
|
5
|
|
|
5
|
1
|
10
|
my ($self, $factory, $arg) = @_; |
65
|
|
|
|
|
|
|
|
66
|
5
|
100
|
|
|
|
14
|
$arg->{attr}{name} = $arg->{attr}{id} if not defined $arg->{attr}{name}; |
67
|
|
|
|
|
|
|
|
68
|
5
|
|
|
|
|
13
|
my $widget = HTML::Element->new('textarea'); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
$widget->attr($_ => $arg->{attr}{$_}) |
71
|
5
|
|
|
|
|
90
|
for grep {; defined $arg->{attr}{$_} } keys %{ $arg->{attr} }; |
|
10
|
|
|
|
|
25
|
|
|
5
|
|
|
|
|
11
|
|
72
|
|
|
|
|
|
|
|
73
|
5
|
100
|
|
|
|
84
|
$widget->push_content($arg->{value}) if defined $arg->{value}; |
74
|
|
|
|
|
|
|
|
75
|
5
|
|
|
|
|
54
|
return $widget->as_XML; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub rewrite_arg { |
79
|
5
|
|
|
5
|
1
|
8
|
my ($self, $arg, @rest) = @_; |
80
|
|
|
|
|
|
|
|
81
|
5
|
|
|
|
|
14
|
$arg = $self->SUPER::rewrite_arg($arg, @rest); |
82
|
|
|
|
|
|
|
|
83
|
5
|
100
|
|
|
|
10
|
if ($self->{default_classes}) { |
84
|
2
|
|
|
|
|
2
|
my $class = join q{ }, @{ $self->{default_classes} }; |
|
2
|
|
|
|
|
5
|
|
85
|
2
|
100
|
|
|
|
6
|
$arg->{attr}{class} = defined $arg->{attr}{class} |
86
|
|
|
|
|
|
|
? "$class $arg->{attr}{class}" |
87
|
|
|
|
|
|
|
: $class; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
5
|
|
|
|
|
10
|
return $arg; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
__END__ |