CGI::T...t::Box(3pm)

πŸ“¦
version 1.111 Β· 2 versions
  • 1.111 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 1.111 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

CGI::Test::Form::Widget::Box β€” the abstract representation of a tickable box πŸ’… (yes bestie, that's the manual name up top, we're just folding it in so it doesn't look like a robot wrote this 🫢)


🌸 SYNOPSIS 🌸

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

πŸŽ€ DESCRIPTION πŸŽ€

okay so. This class is the abstract representation of a tickable box, meaning a radio button or a checkbox. That's it. That's the whole vibe. πŸ¦‹

Wanna simulate a user actually clicking that box on or off? Use the check() and uncheck() routines, described down below. Iconic, no cap.


πŸ’– INTERFACE πŸ’–

The interface is exactly the same as the one described in CGI::Test::Form::Widget, plus these additions right here πŸ‘‡

🌈 Attributes 🌈

  • group β€” the CGI::Test::Form::Group object that holds all the groups of the same widget type.
  • group_list β€” the list of widgets that belong to the same group as we do. (our little squad πŸ’œ)
  • is_checked β€” true when the box is checked, i.e. marked with a tick. βœ…

✨ Attribute Setting ✨

  • check β€” check the box, by ticking it.
  • check_tagged tag β€” you can call this on any box, and it'll hunt down the box whose value attribute is tag inside the group_list, and then check it. πŸ”

If that tag is nowhere to be found, the caller gets a warning via carp. Not a vibe, but okay.

  • uncheck β€” uncheck the box, by removing its ticking mark. ⚠️ Heads up though: it is not possible to do this on a radio button β€” you must check another radio button of the same group instead. That's just the rules, bestie.
  • uncheck_tagged tag β€” same deal, call it on any box, it finds the box whose value attribute is tag within the group_list, and removes its ticking mark. It is not possible to do this on a radio button, as explained in uncheck above. 😭

And again: if the specified tag is not found, the caller gets a warning via carp.

πŸ¦‹ Widget Classification Predicates πŸ¦‹

There's one extra predicate to tell a checkbox apart from a radio button:

  • is_radio β€” returns true for a radio button. πŸ“»
  • is_standalone β€” returns true if the box is the sole member of its group.

Normally only useful for checkboxes: a standalone radio button, although perfectly legal, would always remain in the checked state, and therefore not be especially interesting... πŸ’€ so like, technically valid, practically a snooze.

🧚 Miscellaneous Features 🧚

Although documented, these features are more targeted for internal use... iykyk πŸ™ˆ

  • set_is_checked flag β€” change the checked status. Radio buttons can only be checked, i.e. the flag must be true: all other radio buttons in the same group are immediately unchecked.
bestie pls β€” you should use the check and uncheck convenience routines instead of calling this feature directly. πŸ’…

πŸ‘‘ 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::Box::Radio(3), CGI::Test::Form::Widget::Box::Check(3).


and that's a wrap, angel 🫢 this was perl v5.34.0, dated 2022-06-10, filed under the manual name CGI::T...t::Box(3pm) β€” go check some boxes, slay, periodt πŸ’–βœ¨