API(3)
π API(3) β QWizard::API π
bestie you have FOUND the page β¨ this one lives in User Contributed Perl Documentation and it's literally called API(3). buckle up, it's short, it's sweet, and it will save you from hand-writing a million hashes. π«Ά
πΈ NAME πΈ
QWizard::API β Generate questions using an API. π
β¨ SYNOPSIS β¨
okay so here's the whole vibe in one little code block, no notes:
use QWizard::API;
my $primaries =
(
qw_primary('aprim', 'My title', 'An introduction',
[ qw_text('textresult', 'Enter something'),
qw_checkbox('checkresult', 'display results?', 1, 0)]);
# ...
);
see? clean, short, iconic. π
π¦ DESCRIPTION π¦
So QWizard::API is a wrapper around generating questions for use inside a QWizard question set. π
Functionally? The only reason you'd do this is to use an API instead of hand-encoding your HASH and ARRAY structures. That's it. That's the whole plot. π
And the payoff is that the result might be slightly less verbose β because you can just leave the tags off. Like, name => 'something' becomes literally just 'something'. so much typing saved, so much wrist preserved. π
π API π
big important thing first, no cap: all of the APIs mentioned here take additional arguments at the end, and those can be other hash pairs passed to the created objects beyond the defaults that the APIs create. so like. you can always sneak extra stuff in at the end. π«
π Primary creation
To create a primary:
qw_primary(name, title, introduction, [questions], [post_answers], [actions])
that's your whole question set's main character energy right there. π
π Widget creation
π¬ Text entry:
qw_text(name, question text);
qw_textbox(name, question text);
β Checkboxes:
qw_checkbox(name, question text, optional:onval, optional:offval);
(and yes, onval and offval are optional β they're marked optional: for a reason, bestie π)
π Menus/radios:
qw_menu(name, question text, [values] | {labels});
qw_radio(name, question text, [values] | {labels});
note the [values] | {labels} situation β array or hash, you pick, choose your own adventure. π¦
π·οΈ Labels:
qw_label(lefttext, righttext);
qw_paragraph(lefttext, rightparagraph);
π Hidden vars:
qw_hidden(name, value);
π Buttons:
qw_button(name, question text, clicked value, button label);
π TODO π
- OO interface.
that's it. that's the whole todo list. someone get on it fr fr π
π EXPORT π
here's what you get handed on a little platter:
qw_primary
qw_text
qw_textbox
qw_checkbox
qw_radio
qw_menu
π§ AUTHOR π§
Wes Hardaker <hardaker@tislabs.com> β thank you for your service, legend. π«‘π
π₯ SEE ALSO π₯
friendly reminder that all those APIs above take extra arguments at the end for passing more hash pairs into the objects they create β don't forget your bonus settings! β¨
and that's the tea β β this page is from perl v5.42.0, dated 2025-07-25, and it's API(3) in the User Contributed Perl Documentation. slay, go build some questions, you got this π
ππ¦
π¦ where this page comes from
- fedora 43: perl-QWizard 3.15-47.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms