line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
15
|
|
|
15
|
|
10363
|
use strict; |
|
15
|
|
|
|
|
31
|
|
|
15
|
|
|
|
|
527
|
|
2
|
15
|
|
|
15
|
|
76
|
use warnings; |
|
15
|
|
|
|
|
25
|
|
|
15
|
|
|
|
|
707
|
|
3
|
|
|
|
|
|
|
package HTML::Widget::Plugin::Textarea; |
4
|
|
|
|
|
|
|
# ABSTRACT: a widget for a large text entry box |
5
|
|
|
|
|
|
|
$HTML::Widget::Plugin::Textarea::VERSION = '0.202'; |
6
|
15
|
|
|
15
|
|
77
|
use parent 'HTML::Widget::Plugin'; |
|
15
|
|
|
|
|
27
|
|
|
15
|
|
|
|
|
81
|
|
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
|
55
|
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, the widget will be initially populated by its value. |
52
|
|
|
|
|
|
|
#pod |
53
|
|
|
|
|
|
|
#pod =back |
54
|
|
|
|
|
|
|
#pod |
55
|
|
|
|
|
|
|
#pod =cut |
56
|
|
|
|
|
|
|
|
57
|
15
|
|
|
15
|
|
3185
|
use HTML::Element; |
|
15
|
|
|
|
|
34
|
|
|
15
|
|
|
|
|
116
|
|
58
|
|
|
|
|
|
|
|
59
|
17
|
|
|
17
|
|
67
|
sub _attribute_args { qw(disabled id) } |
60
|
34
|
|
|
34
|
|
108
|
sub _boolean_args { qw(disabled) } |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub textarea { |
63
|
4
|
|
|
4
|
1
|
9
|
my ($self, $factory, $arg) = @_; |
64
|
|
|
|
|
|
|
|
65
|
4
|
100
|
|
|
|
15
|
$arg->{attr}{name} = $arg->{attr}{id} if not defined $arg->{attr}{name}; |
66
|
|
|
|
|
|
|
|
67
|
4
|
|
|
|
|
20
|
my $widget = HTML::Element->new('textarea'); |
68
|
|
|
|
|
|
|
|
69
|
4
|
|
|
|
|
100
|
$widget->attr($_ => $arg->{attr}{$_}) for keys %{ $arg->{attr} }; |
|
4
|
|
|
|
|
26
|
|
70
|
|
|
|
|
|
|
|
71
|
4
|
|
|
|
|
114
|
$widget->push_content($arg->{value}); |
72
|
|
|
|
|
|
|
|
73
|
4
|
|
|
|
|
63
|
return $widget->as_XML; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub rewrite_arg { |
77
|
4
|
|
|
4
|
1
|
9
|
my ($self, $arg, @rest) = @_; |
78
|
|
|
|
|
|
|
|
79
|
4
|
|
|
|
|
26
|
$arg = $self->SUPER::rewrite_arg($arg, @rest); |
80
|
|
|
|
|
|
|
|
81
|
4
|
100
|
|
|
|
12
|
if ($self->{default_classes}) { |
82
|
2
|
|
|
|
|
6
|
my $class = join q{ }, @{ $self->{default_classes} }; |
|
2
|
|
|
|
|
6
|
|
83
|
2
|
100
|
|
|
|
9
|
$arg->{attr}{class} = defined $arg->{attr}{class} |
84
|
|
|
|
|
|
|
? "$class $arg->{attr}{class}" |
85
|
|
|
|
|
|
|
: $class; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
4
|
|
|
|
|
13
|
return $arg; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
1; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
__END__ |