logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

CGI::Test::Form::Widget::Button - Abstract representation of a button

Authors

       The original author is Raphael Manfredi.

       Steven Hilton was long time maintainer of this module.

       Current maintainer is Alexander Tokarev <tokarev@cpan.org>.

Description

       This class is the abstract representation of a button, i.e. a submit button, an image button, a reset
       button or a plain button.

       Pressing a button is achieved by calling "press()" on it, which returns a new page, as a
       "CGI::Test::Page" object, or "undef" if pressing had no round-trip effect.

Interface

       The interface is the same as the one described in CGI::Test::Form::Widget, with the following additions:

   Attributes
       "is_pressed"
           True when the button is pressed.

   AttributeSetting
       "press"
           Press the button, setting "is_pressed" to true.

           If  the  button is a reset button ("is_reset" is true), all widgets are reset to their initial state,
           and "undef" is returned.

           If the button is a submit button ("is_submit"  is  true),  then  a  GET/POST  request  is  issued  as
           appropriate and the reply is made available through a "CGI::Test::Page" object.

           Otherwise,  the  button  pressing is ignored, a warning is issued from the perspective of the caller,
           via "carp", and "undef" is returned.

   WidgetClassificationPredicates
       There is an additional set of predicates to distinguish between the various buttons:

       "is_plain"
           Returns true for a plain button, i.e. a button that has  no  submit/reset  effects.   Usually,  those
           buttons are linked to a script, but "CGI::Test" does not support scripting yet.

       "is_reset"
           Returns true for reset buttons.

       "is_submit"
           Returns  true  for  submit  buttons, whether they are really shown as buttons or as images.  A submit
           button will cause an HTTP request to be issued in response to its being pressed.

   MiscellaneousFeatures
       Although documented, those features are more targetted for internal use...

       "set_is_pressed" flag
           Change the pressed status of the button, to the value of flag.  It does  not  raise  any  other  side
           effect, like submitting an HTTP request if the button is a submit button.

           You should probably use the "press" convenience routine instead of calling this feature directly.

Name

       CGI::Test::Form::Widget::Button - Abstract representation of a button

See Also

CGI::Test::Form::Widget(3),                                    CGI::Test::Form::Widget::Button::Image(3),
       CGI::Test::Form::Widget::Button::Plain(3),                     CGI::Test::Form::Widget::Button::Reset(3),
       CGI::Test::Form::Widget::Button::Submit(3).

perl v5.34.0                                       2022-06-10               CGI::Test::Form::Widget::Button(3pm)

Synopsis

        # Inherits from CGI::Test::Form::Widget

See Also