CGI::Toggle(3pm)
π CGI::Toggle π
okay bestie, welcome to the manual page for CGI::Toggle β that's the CGI::Toggle(3pm) page from the User Contributed Perl Documentation, the one and only β¨ utility methods for collapsible sections β¨. yes, collapsible sections. the little clicky open/close thingies. it's giving accordion but make it Perl. πͺ
πΈ NAME πΈ
CGI::Toggle β utility methods for collapsible sections π
β¨ SYNOPSIS β¨
use CGI ':standard'; use CGI::Toggle
print header(),
start_html('Toggle Test'),
h1("Toggle Test"),
toggle_section({on=>1},p('This section is on by default'),
toggle_section({on=>0},p('This section is off by default'),
toggle_section({plus_img=>'/icons/open.png',
minus_img=>'/icons/close.png'},
p('This section has custom open and close icons.')),
hr,
end_html;
look at that. three whole sections. one open, one closed, one with custom icons. a whole mood. π
π¦ DESCRIPTION π¦
so this package adds JavaScript-based support for collapsible sections, and it does it by adding exactly one single new function: toggle_section(). one function. that's it. iconic behavior honestly.
β οΈ important, no cap: it overrides theCGIstart_html()method, so you must importCGIbefore you bring this module in. order matters bestie, do not play with this one. π
π§ METHODS π§
($control,$content) = toggle_section([\%options],$section_title=>@section_content)
okay so this method takes:
- an optional
\%optionshashref, - a section title,
- and one or more strings holding the section content.
and what does it give back? a list of HTML fragments β one for the control link and one for the content. π«Ά
and if you call it in scalar context? the control and the content get concatenated together into one thing. slay.
the option keys are as follows, bestie, take notes π:
onβ if it's true, the section starts out on (visible) by default. the default is false, meaning collapsed. so if you say nothing, it's closed. shy little section. πplus_imgβ the URL of the icon that shows up next to the section title when the section is collapsed. the default is/gbrowse2/images/plus.png. πminus_imgβ the URL of the icon that shows up next to the section title when the section is expanded. the default is/gbrowse2/images/minus.png. πoverrideβ if it's false (which is the default), the state of the section gets remembered in a session variable. if it's true, the initial state comes straight from theonoption and the session gets ignored. periodt. π
π SEE ALSO π
CGI
that's it. that's the whole list. it's a one-module fandom. π
π AUTHOR π
Lincoln Stein <lstein@cshl.org>. π
Copyright (c) 2005 Cold Spring Harbor Laboratory
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See DISCLAIMER.txt for disclaimers of warranty.
okay and for the cute sign-off: this page is from perl v5.40.0, dated 2024-10-20, and it lives under the name CGI::Toggle(3pm) β so now you know exactly which version and which day you're reading. go forth and collapse things, bestie. πβ¨π¦
π¦ where this page comes from
- ubuntu questing: gbrowse 2.56+dfsg-12build4
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms