File Coverage

blib/lib/HTML/Widget/Plugin/Submit.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 2 2 100.0
total 24 24 100.0


line stmt bran cond sub pod time code
1 15     15   11823 use strict;
  15         33  
  15         575  
2 15     15   79 use warnings;
  15         27  
  15         879  
3             package HTML::Widget::Plugin::Submit;
4             # ABSTRACT: for submit type inputs
5             $HTML::Widget::Plugin::Submit::VERSION = '0.202';
6 15     15   75 use parent 'HTML::Widget::Plugin::Input';
  15         28  
  15         94  
7              
8             #pod =head1 SYNOPSIS
9             #pod
10             #pod $widget_factory->submit({
11             #pod id => 'button-id', # will be used as default control name, too
12             #pod value => 'button label',
13             #pod });
14             #pod
15             #pod =head1 DESCRIPTION
16             #pod
17             #pod This plugin provide a simple submit plugin, which returns an input element of
18             #pod type submit.
19             #pod
20             #pod =head1 METHODS
21             #pod
22             #pod =head2 C< provided_widgets >
23             #pod
24             #pod This plugin provides the following widgets: input
25             #pod
26             #pod =cut
27              
28 16     16 1 58 sub provided_widgets { qw(submit) }
29              
30             #pod =head2 C< submit >
31             #pod
32             #pod This method returns a basic submit input.
33             #pod
34             #pod In addition to the generic L attributes, the following
35             #pod are valid arguments:
36             #pod
37             #pod =over
38             #pod
39             #pod =item value
40             #pod
41             #pod This is the widget's initial value, which (for submit inputs) is generally used
42             #pod as the text for the label on its face.
43             #pod
44             #pod =back
45             #pod
46             #pod =cut
47              
48 15     15   1406 use HTML::Element;
  15         27  
  15         95  
49              
50             sub submit {
51 2     2 1 3 my ($self, $factory, $arg) = @_;
52              
53 2         7 $arg->{attr}{type} = 'submit';
54              
55             # I suppose I could carp, here, if the type is altered, but... it's your
56             # foot, shoot it if you want. -- rjbs, 2007-02-28]
57              
58 2         12 $self->build($factory, $arg);
59             }
60              
61             1;
62              
63             __END__