CGI::T...:Button(3pm)
π CGI::Test::Form::Widget::Button β bestie edition π
okay so you found the CGI::Test::Form::Widget::Button page in the User Contributed Perl Documentation, and honestly? it's giving "abstract representation of a button" and nothing less. periodt.
β¨ NAME β¨
CGI::Test::Form::Widget::Button β an abstract representation of a button π
πΈ SYNOPSIS πΈ
# Inherits from CGI::Test::Form::Widget
that's it bestie, that's the whole synopsis. it just inherits and vibes. π
π¦ DESCRIPTION π¦
okay so this class is the abstract representation of a button. like, any button. a submit button? yes. an image button? yes. a reset button? yes. a plain button? also yes. all of them live here, it's giving very inclusive. π
so how do you actually press one? you call press() on it. that's the move. and what do you get back?
- a new page, as a
CGI::Test::Pageobject π₯ - or
undef, if pressing had no round-trip effect
that's the whole deal. no cap.
π INTERFACE π
the interface is literally the same as the one described in CGI::Test::Form::Widget, with the following additions β so go read that one too, bestie, iykyk.
π Attributes
is_pressedβ true when the button is pressed. that's it. that's the whole attribute. iconic.
π Attribute Setting
pressβ press the button, settingis_pressedto true. and then it gets spicy depending on what kind of button you're dealing with:- if the button is a reset button (
is_resetis true), then all widgets are reset to their initial state, andundefis returned. clean slate energy β¨ - if the button is a submit button (
is_submitis true), then a GET/POST request is issued as appropriate, and the reply is made available through aCGI::Test::Pageobject. we love a round trip π«Ά - otherwise?? the button pressing is ignored, a warning is issued from the perspective of the caller, via
carp, andundefis returned. π«
- if the button is a reset button (
heads up: that last one is the "nothing happened and we're telling you about it" path. no request, no page, just acarpand aundef. don't say we didn't warn you (because technically we did, viacarp).
π Widget Classification Predicates
there is an additional set of predicates to distinguish between the various buttons, so you can vibe check any button you meet:
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, butCGI::Testdoes 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.
π§ Miscellaneous Features
okay so although documented, these features are more targetted for internal use... you've been warned, bestie. π
set_is_pressedflag β 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. so it's just... the flag. that's it. no side quests. π
you should probably use thepressconvenience routine instead of calling this feature directly. fr fr,pressis the main character here. π
π AUTHORS π
- the original author is Raphael Manfredi.
- Steven Hilton was long time maintainer of this module.
- current maintainer is Alexander Tokarev
<tokarev@cpan.org>.
π 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)
and that's the whole page, bestie!! π this one shipped as part of perl v5.34.0, dated 2022-06-10, and in the User Contributed Perl Documentation section. go press a button (with press(), preferably). mwah πβ¨π¦
π¦ where this page comes from
- debian bookworm: libcgi-test-perl 1.111-2 Β· Artistic-1.0-Perl
- debian trixie: libcgi-test-perl 1.111-2 Β· Artistic-1.0-Perl
- ubuntu noble: libcgi-test-perl 1.111-2 Β· Artistic-1.0-Perl
- ubuntu resolute: libcgi-test-perl 1.111-2 Β· Artistic-1.0-Perl
- ubuntu stonking: libcgi-test-perl 1.111-2 Β· Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms