| 1 | package CGI::Test::Form::Widget::Button::Submit; | ||
| 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: 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 | ▶ | use Carp; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | |||
| 17 | # | ||
| 18 | # This class models a FORM submit button. | ||
| 19 | # | ||
| 20 | |||
| 21 | 14 | ▶ | use base qw(CGI::Test::Form::Widget::Button); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 22 | |||
| 23 | # | ||
| 24 | # Attribute access | ||
| 25 | # | ||
| 26 | |||
| 27 | sub gui_type | ||
| 28 | 0 | ▶ | { |
|
Subroutine
gui_type: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 29 | 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 | 19 | ▶ | { |
|
Subroutine
press: called CC=1 SCAR=0.0
Pod
documented
| |||
| 42 | 19 | my $this = shift; | |
| 43 | 19 | $this->set_is_pressed(1); | |
| 44 | 19 | return $this->form->submit; | |
| 45 | } | ||
| 46 | |||
| 47 | # | ||
| 48 | # Button predicates | ||
| 49 | # | ||
| 50 | |||
| 51 | sub is_submit | ||
| 52 | 48 | ▶ | { |
|
Subroutine
is_submit: called CC=1 SCAR=0.0
Pod
documented
| |||
| 53 | 48 | return 1; | |
| 54 | } | ||
| 55 | |||
| 56 | 14 | 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<CGI::Test::Form::Widget::Button>. | ||
| 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 F<E<lt>tokarev@cpan.orgE<gt>>. | ||
| 85 | |||
| 86 | =head1 SEE ALSO | ||
| 87 | |||
| 88 | CGI::Test::Form::Widget::Button(3). | ||
| 89 | |||
| 90 | =cut | ||
| 91 | |||