| 1 | package CGI::Test::Form::Widget::Button::Reset; | ||
| 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: Reset.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 reset 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 "reset button"; | |
| 30 | } | ||
| 31 | |||
| 32 | # | ||
| 33 | # ->press | ||
| 34 | # | ||
| 35 | # Press button. | ||
| 36 | # Has immediate effect: all widgets are reset to their initial state. | ||
| 37 | # | ||
| 38 | # Returns undef. | ||
| 39 | # | ||
| 40 | sub press | ||
| 41 | 0 | ▶ | { |
|
Subroutine
press: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 42 | 0 | my $this = shift; | |
| 43 | 0 | $this->form->reset(); | |
| 44 | 0 | return undef; | |
| 45 | } | ||
| 46 | |||
| 47 | # | ||
| 48 | # Global widget predicates | ||
| 49 | # | ||
| 50 | |||
| 51 | sub is_read_only | ||
| 52 | 0 | ▶ | { |
|
Subroutine
is_read_only: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 53 | 0 | return 1; | |
| 54 | } # Handled internally by client | ||
| 55 | |||
| 56 | # | ||
| 57 | # Button predicates | ||
| 58 | # | ||
| 59 | |||
| 60 | sub is_reset | ||
| 61 | 0 | ▶ | { |
|
Subroutine
is_reset: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 62 | 0 | return 1; | |
| 63 | } | ||
| 64 | |||
| 65 | 14 | 1; | |
| 66 | |||
| 67 | =head1 NAME | ||
| 68 | |||
| 69 | CGI::Test::Form::Widget::Button::Reset - A reset button | ||
| 70 | |||
| 71 | =head1 SYNOPSIS | ||
| 72 | |||
| 73 | # Inherits from CGI::Test::Form::Widget::Button | ||
| 74 | # $form is a CGI::Test::Form | ||
| 75 | |||
| 76 | my @reset = $form->buttons_matching(sub { $_[0]->is_reset }); | ||
| 77 | $reset[0]->press if @reset; | ||
| 78 | |||
| 79 | =head1 DESCRIPTION | ||
| 80 | |||
| 81 | This class models a reset button. Pressing this buttom immediately | ||
| 82 | resets the form to its original state. The processing is done on the | ||
| 83 | client-side, and no request is made to the HTTP server. | ||
| 84 | |||
| 85 | The interface is the same as the one described in | ||
| 86 | L<CGI::Test::Form::Widget::Button>. | ||
| 87 | |||
| 88 | =head1 AUTHORS | ||
| 89 | |||
| 90 | The original author is Raphael Manfredi. | ||
| 91 | |||
| 92 | Steven Hilton was long time maintainer of this module. | ||
| 93 | |||
| 94 | Current maintainer is Alexander Tokarev F<E<lt>tokarev@cpan.orgE<gt>>. | ||
| 95 | |||
| 96 | =head1 SEE ALSO | ||
| 97 | |||
| 98 | CGI::Test::Form::Widget::Button(3). | ||
| 99 | |||
| 100 | =cut | ||
| 101 | |||