File Coverage

blib/lib/CGI/Test/Form/Widget/Button/Submit.pm
Criterion Covered Total %
statement 16 17 94.1
branch n/a
condition n/a
subroutine 6 7 85.7
pod 3 3 100.0
total 25 27 92.5


line stmt bran cond sub pod time code
1             package CGI::Test::Form::Widget::Button::Submit;
2 14     14   40 use strict;
  14         16  
  14         310  
3 14     14   41 use warnings;
  14         11  
  14         254  
4             ##################################################################
5             # $Id: Submit.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     14   33 use Carp;
  14         12  
  14         586  
16              
17             #
18             # This class models a FORM submit button.
19             #
20              
21 14     14   52 use base qw(CGI::Test::Form::Widget::Button);
  14         12  
  14         5122  
22              
23             #
24             # Attribute access
25             #
26              
27             sub gui_type
28             {
29 0     0 1 0 return "submit button";
30             }
31              
32             #
33             # ->press
34             #
35             # Press button.
36             # Has immediate effect: a GET/POST request is issued.
37             #
38             # Returns resulting CGI::Test::Page.
39             #
40             sub press
41             {
42 19     19 1 2532 my $this = shift;
43 19         107 $this->set_is_pressed(1);
44 19         75 return $this->form->submit;
45             }
46              
47             #
48             # Button predicates
49             #
50              
51             sub is_submit
52             {
53 48     48 1 83 return 1;
54             }
55              
56             1;
57              
58             =head1 NAME
59              
60             CGI::Test::Form::Widget::Button::Submit - A submit button
61              
62             =head1 SYNOPSIS
63              
64             # Inherits from CGI::Test::Form::Widget::Button
65             # $form is a CGI::Test::Form
66              
67             my $send = $form->submit_by_name("send");
68             my $answer = $send->press;
69              
70             =head1 DESCRIPTION
71              
72             This class models a submit button.
73             Pressing it immediately triggers an HTTP request, as defined by the form.
74              
75             The interface is the same as the one described in
76             L.
77              
78             =head1 AUTHORS
79              
80             The original author is Raphael Manfredi.
81              
82             Steven Hilton was long time maintainer of this module.
83              
84             Current maintainer is Alexander Tokarev Ftokarev@cpan.orgE>.
85              
86             =head1 SEE ALSO
87              
88             CGI::Test::Form::Widget::Button(3).
89              
90             =cut
91