xref: /freebsd/contrib/dialog/demo.pl (revision c6879c6c14eedbd060ba588a3129a6c60ebbe783)
1*f4f33ea0SBaptiste Daroussin#!/usr/bin/env perl
2*f4f33ea0SBaptiste Daroussin# $Id: demo.pl,v 1.23 2018/06/12 21:39:44 tom Exp $
3*f4f33ea0SBaptiste Daroussin################################################################################
4*f4f33ea0SBaptiste Daroussin#  Copyright 2018	Thomas E. Dickey
5*f4f33ea0SBaptiste Daroussin#
6*f4f33ea0SBaptiste Daroussin#  This program is free software; you can redistribute it and/or modify
7*f4f33ea0SBaptiste Daroussin#  it under the terms of the GNU Lesser General Public License, version 2.1
8*f4f33ea0SBaptiste Daroussin#  as published by the Free Software Foundation.
9*f4f33ea0SBaptiste Daroussin#
10*f4f33ea0SBaptiste Daroussin#  This program is distributed in the hope that it will be useful, but
11*f4f33ea0SBaptiste Daroussin#  WITHOUT ANY WARRANTY; without even the implied warranty of
12*f4f33ea0SBaptiste Daroussin#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13*f4f33ea0SBaptiste Daroussin#  Lesser General Public License for more details.
14*f4f33ea0SBaptiste Daroussin#
15*f4f33ea0SBaptiste Daroussin#  You should have received a copy of the GNU Lesser General Public
16*f4f33ea0SBaptiste Daroussin#  License along with this program; if not, write to
17*f4f33ea0SBaptiste Daroussin#	Free Software Foundation, Inc.
18*f4f33ea0SBaptiste Daroussin#	51 Franklin St., Fifth Floor
19*f4f33ea0SBaptiste Daroussin#	Boston, MA 02110, USA.
20*f4f33ea0SBaptiste Daroussin################################################################################
21*f4f33ea0SBaptiste Daroussin# This demonstration is provided solely to exercise the sample Perl wrapper for
22*f4f33ea0SBaptiste Daroussin# dialog which is included in its source-code.  See libui-dialog-perl for a
23*f4f33ea0SBaptiste Daroussin# more comprehensive binding.
24*f4f33ea0SBaptiste Daroussin#
25*f4f33ea0SBaptiste Daroussin# TODO: modify dialog.pl to use $DIALOG environment variable, drive from GetOpts here
26*f4f33ea0SBaptiste Daroussin# TODO: eliminate constant $scr_lines in dialog.pl
27*f4f33ea0SBaptiste Daroussin
28*f4f33ea0SBaptiste Daroussinuse warnings;
29*f4f33ea0SBaptiste Daroussinuse strict;
30*f4f33ea0SBaptiste Daroussinuse diagnostics;
31*f4f33ea0SBaptiste Daroussin
32*f4f33ea0SBaptiste Daroussinuse FindBin qw($Bin $Script);
33*f4f33ea0SBaptiste Daroussinuse lib "$Bin";
34*f4f33ea0SBaptiste Daroussin
35*f4f33ea0SBaptiste Daroussinrequire "dialog.pl";
36*f4f33ea0SBaptiste Daroussindialog->import('@dialog_result');
37*f4f33ea0SBaptiste Daroussinour @dialog_result;
38*f4f33ea0SBaptiste Daroussin
39*f4f33ea0SBaptiste Daroussinsub tput($$) {
40*f4f33ea0SBaptiste Daroussin    my $name    = shift;
41*f4f33ea0SBaptiste Daroussin    my $default = shift;
42*f4f33ea0SBaptiste Daroussin    my $value   = `tput "$name"`;
43*f4f33ea0SBaptiste Daroussin    chomp $value;
44*f4f33ea0SBaptiste Daroussin    $value = $default unless ( $value =~ /^[0-9]+$/ );
45*f4f33ea0SBaptiste Daroussin    return $value;
46*f4f33ea0SBaptiste Daroussin}
47*f4f33ea0SBaptiste Daroussin
48*f4f33ea0SBaptiste Daroussinsub napms($) {
49*f4f33ea0SBaptiste Daroussin    my $msecs = shift;
50*f4f33ea0SBaptiste Daroussin    select( undef, undef, undef, $msecs * 0.001 );
51*f4f33ea0SBaptiste Daroussin}
52*f4f33ea0SBaptiste Daroussin
53*f4f33ea0SBaptiste Daroussinsub show_results($$) {
54*f4f33ea0SBaptiste Daroussin    my $title = shift;
55*f4f33ea0SBaptiste Daroussin    my $width = shift;
56*f4f33ea0SBaptiste Daroussin    &rhs_msgbox(
57*f4f33ea0SBaptiste Daroussin        $title,
58*f4f33ea0SBaptiste Daroussin        sprintf(
59*f4f33ea0SBaptiste Daroussin            "Resulting text:\\n    %s", join( '\\n    ', @dialog_result )
60*f4f33ea0SBaptiste Daroussin        ),
61*f4f33ea0SBaptiste Daroussin        $width
62*f4f33ea0SBaptiste Daroussin    );
63*f4f33ea0SBaptiste Daroussin}
64*f4f33ea0SBaptiste Daroussin
65*f4f33ea0SBaptiste Daroussinsub doit() {
66*f4f33ea0SBaptiste Daroussin    my $status         = 1;
67*f4f33ea0SBaptiste Daroussin    my $RHS_CLEAR      = "clear";
68*f4f33ea0SBaptiste Daroussin    my $RHS_TEXTBOX    = "textbox";
69*f4f33ea0SBaptiste Daroussin    my $RHS_MSGBOX     = "msgbox";
70*f4f33ea0SBaptiste Daroussin    my $RHS_INFOBOX    = "infobox";
71*f4f33ea0SBaptiste Daroussin    my $RHS_YESNO      = "yesno";
72*f4f33ea0SBaptiste Daroussin    my $RHS_GAUGE      = "gauge";
73*f4f33ea0SBaptiste Daroussin    my $RHS_INPUTBOX   = "inputbox";
74*f4f33ea0SBaptiste Daroussin    my $RHS_MENU       = "menu";
75*f4f33ea0SBaptiste Daroussin    my $RHS_MENUL      = "menul";
76*f4f33ea0SBaptiste Daroussin    my $RHS_MENUA      = "menua";
77*f4f33ea0SBaptiste Daroussin    my $RHS_CHECKLIST  = "checklist";
78*f4f33ea0SBaptiste Daroussin    my $RHS_CHECKLISTL = "checklistl";
79*f4f33ea0SBaptiste Daroussin    my $RHS_CHECKLISTA = "checklista";
80*f4f33ea0SBaptiste Daroussin    my $RHS_RADIOLIST  = "radiolist";
81*f4f33ea0SBaptiste Daroussin
82*f4f33ea0SBaptiste Daroussin    my @demo_2col = qw(
83*f4f33ea0SBaptiste Daroussin      This      that
84*f4f33ea0SBaptiste Daroussin      is        has
85*f4f33ea0SBaptiste Daroussin      a         this
86*f4f33ea0SBaptiste Daroussin      2-column  quoted
87*f4f33ea0SBaptiste Daroussin      menu      "tag".
88*f4f33ea0SBaptiste Daroussin    );
89*f4f33ea0SBaptiste Daroussin    my @demo_3col;
90*f4f33ea0SBaptiste Daroussin    my @demo_tags;
91*f4f33ea0SBaptiste Daroussin    my %demo_hash;
92*f4f33ea0SBaptiste Daroussin
93*f4f33ea0SBaptiste Daroussin    for ( my $s = 0, my $t = 0 ; $s <= $#demo_2col ; $s += 2, $t += 3 ) {
94*f4f33ea0SBaptiste Daroussin        my $d  = $s / 2;
95*f4f33ea0SBaptiste Daroussin        my $c1 = $demo_2col[$s];
96*f4f33ea0SBaptiste Daroussin        my $c2 = $demo_2col[ $s + 1 ];
97*f4f33ea0SBaptiste Daroussin        $demo_3col[$t] = $c1;
98*f4f33ea0SBaptiste Daroussin        $demo_3col[ $t + 1 ] = $c2;
99*f4f33ea0SBaptiste Daroussin        $demo_3col[ $t + 2 ] = ( $c1 =~ /2/ ) ? 1 : 0;
100*f4f33ea0SBaptiste Daroussin        $demo_tags[$d] = $c1;
101*f4f33ea0SBaptiste Daroussin        $demo_tags[$d] =~ s/2/1/;
102*f4f33ea0SBaptiste Daroussin        $demo_tags[ $d + ( $#demo_2col + 1 ) / 2 ] = $c2;
103*f4f33ea0SBaptiste Daroussin        $demo_hash{ sprintf( "%d %s", $d, $c1 ) } = $c2;
104*f4f33ea0SBaptiste Daroussin    }
105*f4f33ea0SBaptiste Daroussin
106*f4f33ea0SBaptiste Daroussin    while ( $status > 0 ) {
107*f4f33ea0SBaptiste Daroussin        my $lines = &tput( "lines", 24 );
108*f4f33ea0SBaptiste Daroussin        my $cols  = &tput( "cols",  80 );
109*f4f33ea0SBaptiste Daroussin        my $maxcols = $cols - 4;
110*f4f33ea0SBaptiste Daroussin        my $mincols = ( $cols > 8 ) ? 8 : $cols;
111*f4f33ea0SBaptiste Daroussin        my $midcols = int( ( $cols * 3 ) / 4 );
112*f4f33ea0SBaptiste Daroussin
113*f4f33ea0SBaptiste Daroussin        @dialog_result = ();
114*f4f33ea0SBaptiste Daroussin        $status        = &rhs_menu(
115*f4f33ea0SBaptiste Daroussin            "My title",      "My message",
116*f4f33ea0SBaptiste Daroussin            0,               14,
117*f4f33ea0SBaptiste Daroussin            $RHS_CLEAR,      "clear and exit",
118*f4f33ea0SBaptiste Daroussin            $RHS_TEXTBOX,    "text-box of this script",
119*f4f33ea0SBaptiste Daroussin            $RHS_MSGBOX,     "informational-message, OK button",
120*f4f33ea0SBaptiste Daroussin            $RHS_INFOBOX,    "informational-message, no button",
121*f4f33ea0SBaptiste Daroussin            $RHS_YESNO,      "message with Yes/No buttons",
122*f4f33ea0SBaptiste Daroussin            $RHS_GAUGE,      "message with progress-gauge",
123*f4f33ea0SBaptiste Daroussin            $RHS_INPUTBOX,   "input-box",
124*f4f33ea0SBaptiste Daroussin            $RHS_MENU,       "menu, with tags and description",
125*f4f33ea0SBaptiste Daroussin            $RHS_MENUL,      "menu, using only tags",
126*f4f33ea0SBaptiste Daroussin            $RHS_MENUA,      "alphabetically sorted menu",
127*f4f33ea0SBaptiste Daroussin            $RHS_CHECKLIST,  "check-list with tags and description",
128*f4f33ea0SBaptiste Daroussin            $RHS_CHECKLISTL, "check-list using only tags",
129*f4f33ea0SBaptiste Daroussin            $RHS_CHECKLISTA, "alphabetically sorted check-list",
130*f4f33ea0SBaptiste Daroussin            $RHS_RADIOLIST,  "list of radio-buttons"
131*f4f33ea0SBaptiste Daroussin        );
132*f4f33ea0SBaptiste Daroussin        if ( $status > 0 and $#dialog_result == 0 ) {
133*f4f33ea0SBaptiste Daroussin
134*f4f33ea0SBaptiste Daroussin            my $testcase = $dialog_result[0];
135*f4f33ea0SBaptiste Daroussin            if ( $testcase eq $RHS_CLEAR ) {
136*f4f33ea0SBaptiste Daroussin                &rhs_clear;
137*f4f33ea0SBaptiste Daroussin                last;
138*f4f33ea0SBaptiste Daroussin            }
139*f4f33ea0SBaptiste Daroussin            elsif ( $testcase eq $RHS_TEXTBOX ) {
140*f4f33ea0SBaptiste Daroussin                &rhs_textbox( "This script", "$Script", 0, 0 );
141*f4f33ea0SBaptiste Daroussin            }
142*f4f33ea0SBaptiste Daroussin            elsif ( $testcase eq $RHS_MSGBOX ) {
143*f4f33ea0SBaptiste Daroussin                my $msg =
144*f4f33ea0SBaptiste Daroussin                    "This is a demonstration script.\\n"
145*f4f33ea0SBaptiste Daroussin                  . "This should be the second line,\\n"
146*f4f33ea0SBaptiste Daroussin                  . "and this should be the third line,";
147*f4f33ea0SBaptiste Daroussin                &rhs_msgbox( "A message", $msg,
148*f4f33ea0SBaptiste Daroussin                    int( ( length($msg) + 3 ) / 3 ) + 3 );
149*f4f33ea0SBaptiste Daroussin            }
150*f4f33ea0SBaptiste Daroussin            elsif ( $testcase eq $RHS_INFOBOX ) {
151*f4f33ea0SBaptiste Daroussin                my $msg =
152*f4f33ea0SBaptiste Daroussin                    "This is a fairly long line of text, used to"
153*f4f33ea0SBaptiste Daroussin                  . " show how dialog can be used to wrap lines to fit in"
154*f4f33ea0SBaptiste Daroussin                  . " screens with different width.  The text will start wide,"
155*f4f33ea0SBaptiste Daroussin                  . " then get narrower, showing a new infobox for each width"
156*f4f33ea0SBaptiste Daroussin                  . " before going back up to the full width of the terminal.";
157*f4f33ea0SBaptiste Daroussin                my $wide = $maxcols;
158*f4f33ea0SBaptiste Daroussin                while ( $wide > $mincols ) {
159*f4f33ea0SBaptiste Daroussin                    &rhs_infobox( "Info-box", $msg, $wide-- );
160*f4f33ea0SBaptiste Daroussin                    &napms(50);
161*f4f33ea0SBaptiste Daroussin                }
162*f4f33ea0SBaptiste Daroussin                while ( $wide < $maxcols ) {
163*f4f33ea0SBaptiste Daroussin                    &rhs_infobox( "Info-box", $msg, ++$wide );
164*f4f33ea0SBaptiste Daroussin                    &napms(50);
165*f4f33ea0SBaptiste Daroussin                }
166*f4f33ea0SBaptiste Daroussin                &rhs_msgbox( "Info-end", $msg, $wide );
167*f4f33ea0SBaptiste Daroussin            }
168*f4f33ea0SBaptiste Daroussin            elsif ( $testcase eq $RHS_YESNO ) {
169*f4f33ea0SBaptiste Daroussin                if (
170*f4f33ea0SBaptiste Daroussin                    &rhs_yesno(
171*f4f33ea0SBaptiste Daroussin                        "Yes/no",
172*f4f33ea0SBaptiste Daroussin                        "Should \"dialog --yesno\" return \"1\" on \"yes\""
173*f4f33ea0SBaptiste Daroussin                          . " to simplify (some) shell scripts?",
174*f4f33ea0SBaptiste Daroussin                        $cols / 2
175*f4f33ea0SBaptiste Daroussin                    )
176*f4f33ea0SBaptiste Daroussin                  )
177*f4f33ea0SBaptiste Daroussin                {
178*f4f33ea0SBaptiste Daroussin                    &rhs_msgbox(
179*f4f33ea0SBaptiste Daroussin                        "Explanation",
180*f4f33ea0SBaptiste Daroussin                        "No, a successful program exits with "
181*f4f33ea0SBaptiste Daroussin                          . "\"0\" (EXIT_SUCCESS)",
182*f4f33ea0SBaptiste Daroussin                        $cols / 2
183*f4f33ea0SBaptiste Daroussin                    );
184*f4f33ea0SBaptiste Daroussin                }
185*f4f33ea0SBaptiste Daroussin                else {
186*f4f33ea0SBaptiste Daroussin                    &rhs_msgbox(
187*f4f33ea0SBaptiste Daroussin                        "Explanation",
188*f4f33ea0SBaptiste Daroussin                        "Shell scripts assume that \"exit\ 0\" is successful;"
189*f4f33ea0SBaptiste Daroussin                          . " Perl is different.",
190*f4f33ea0SBaptiste Daroussin                        $cols / 2
191*f4f33ea0SBaptiste Daroussin                    );
192*f4f33ea0SBaptiste Daroussin                }
193*f4f33ea0SBaptiste Daroussin            }
194*f4f33ea0SBaptiste Daroussin            elsif ( $testcase eq $RHS_GAUGE ) {
195*f4f33ea0SBaptiste Daroussin                my $pct = 0;
196*f4f33ea0SBaptiste Daroussin                my $sec = 10;
197*f4f33ea0SBaptiste Daroussin                &rhs_gauge(
198*f4f33ea0SBaptiste Daroussin                    "My gauge",
199*f4f33ea0SBaptiste Daroussin                    "Show progress (or lack of it)",
200*f4f33ea0SBaptiste Daroussin                    $midcols * 3, $pct
201*f4f33ea0SBaptiste Daroussin                );
202*f4f33ea0SBaptiste Daroussin                while ( $pct < 100 ) {
203*f4f33ea0SBaptiste Daroussin                    $pct++;
204*f4f33ea0SBaptiste Daroussin                    &napms($sec);
205*f4f33ea0SBaptiste Daroussin                    $sec *= 1.04;
206*f4f33ea0SBaptiste Daroussin                    &rhs_update_gauge($pct);
207*f4f33ea0SBaptiste Daroussin                }
208*f4f33ea0SBaptiste Daroussin                $pct = 99;
209*f4f33ea0SBaptiste Daroussin                &rhs_update_gauge_and_message( "This will go faster", $pct );
210*f4f33ea0SBaptiste Daroussin                while ( $pct > 0 ) {
211*f4f33ea0SBaptiste Daroussin                    $pct--;
212*f4f33ea0SBaptiste Daroussin                    &napms($sec);
213*f4f33ea0SBaptiste Daroussin                    $sec /= 1.05;
214*f4f33ea0SBaptiste Daroussin                    &rhs_update_gauge($pct);
215*f4f33ea0SBaptiste Daroussin                }
216*f4f33ea0SBaptiste Daroussin                &napms(1000);
217*f4f33ea0SBaptiste Daroussin                &rhs_stop_gauge;
218*f4f33ea0SBaptiste Daroussin            }
219*f4f33ea0SBaptiste Daroussin            elsif ( $testcase eq $RHS_INPUTBOX ) {
220*f4f33ea0SBaptiste Daroussin                if (
221*f4f33ea0SBaptiste Daroussin                    &rhs_inputbox(
222*f4f33ea0SBaptiste Daroussin                        "My inputbox", "This demonstrates the inputbox",
223*f4f33ea0SBaptiste Daroussin                        $maxcols,      ""
224*f4f33ea0SBaptiste Daroussin                    )
225*f4f33ea0SBaptiste Daroussin                  )
226*f4f33ea0SBaptiste Daroussin                {
227*f4f33ea0SBaptiste Daroussin                    &show_results( "My inputbox", $midcols );
228*f4f33ea0SBaptiste Daroussin                }
229*f4f33ea0SBaptiste Daroussin            }
230*f4f33ea0SBaptiste Daroussin            elsif ( $testcase eq $RHS_MENU ) {
231*f4f33ea0SBaptiste Daroussin                if (
232*f4f33ea0SBaptiste Daroussin                    &rhs_menu(
233*f4f33ea0SBaptiste Daroussin                        (
234*f4f33ea0SBaptiste Daroussin                            "A menu",
235*f4f33ea0SBaptiste Daroussin                            "This menu uses \"tag\" values and descriptions:",
236*f4f33ea0SBaptiste Daroussin                            $midcols, ( $#demo_2col + 1 ) / 2
237*f4f33ea0SBaptiste Daroussin                        ),
238*f4f33ea0SBaptiste Daroussin                        @demo_2col
239*f4f33ea0SBaptiste Daroussin                    )
240*f4f33ea0SBaptiste Daroussin                  )
241*f4f33ea0SBaptiste Daroussin                {
242*f4f33ea0SBaptiste Daroussin                    &show_results( "My menu", $midcols );
243*f4f33ea0SBaptiste Daroussin                }
244*f4f33ea0SBaptiste Daroussin            }
245*f4f33ea0SBaptiste Daroussin            elsif ( $testcase eq $RHS_MENUL ) {
246*f4f33ea0SBaptiste Daroussin                if (
247*f4f33ea0SBaptiste Daroussin                    &rhs_menul(
248*f4f33ea0SBaptiste Daroussin                        (
249*f4f33ea0SBaptiste Daroussin                            "A menu", "This menu uses only the \"tag\" values:",
250*f4f33ea0SBaptiste Daroussin                            $midcols, $#demo_tags + 1
251*f4f33ea0SBaptiste Daroussin                        ),
252*f4f33ea0SBaptiste Daroussin                        @demo_tags
253*f4f33ea0SBaptiste Daroussin                    )
254*f4f33ea0SBaptiste Daroussin                  )
255*f4f33ea0SBaptiste Daroussin                {
256*f4f33ea0SBaptiste Daroussin                    &show_results( "My long-menu", $midcols );
257*f4f33ea0SBaptiste Daroussin                }
258*f4f33ea0SBaptiste Daroussin            }
259*f4f33ea0SBaptiste Daroussin            elsif ( $testcase eq $RHS_MENUA ) {
260*f4f33ea0SBaptiste Daroussin                if (
261*f4f33ea0SBaptiste Daroussin                    &rhs_menua(
262*f4f33ea0SBaptiste Daroussin                        "A menu", "This menu uses the sorted keys from a hash:",
263*f4f33ea0SBaptiste Daroussin                        $midcols, %demo_hash
264*f4f33ea0SBaptiste Daroussin                    )
265*f4f33ea0SBaptiste Daroussin                  )
266*f4f33ea0SBaptiste Daroussin                {
267*f4f33ea0SBaptiste Daroussin                    &show_results( "My alpha-menu", $midcols );
268*f4f33ea0SBaptiste Daroussin                }
269*f4f33ea0SBaptiste Daroussin            }
270*f4f33ea0SBaptiste Daroussin            elsif ( $testcase eq $RHS_CHECKLIST ) {
271*f4f33ea0SBaptiste Daroussin                if (
272*f4f33ea0SBaptiste Daroussin                    &rhs_checklist(
273*f4f33ea0SBaptiste Daroussin                        (
274*f4f33ea0SBaptiste Daroussin                            "A checklist",
275*f4f33ea0SBaptiste Daroussin                            "This checklist uses \"tag\" values"
276*f4f33ea0SBaptiste Daroussin                              . " and descriptions:",
277*f4f33ea0SBaptiste Daroussin                            $midcols,
278*f4f33ea0SBaptiste Daroussin                            ( $#demo_3col + 1 ) / 3
279*f4f33ea0SBaptiste Daroussin                        ),
280*f4f33ea0SBaptiste Daroussin                        @demo_3col
281*f4f33ea0SBaptiste Daroussin                    )
282*f4f33ea0SBaptiste Daroussin                  )
283*f4f33ea0SBaptiste Daroussin                {
284*f4f33ea0SBaptiste Daroussin                    &show_results( "My checklist", $midcols );
285*f4f33ea0SBaptiste Daroussin                }
286*f4f33ea0SBaptiste Daroussin            }
287*f4f33ea0SBaptiste Daroussin            elsif ( $testcase eq $RHS_CHECKLISTL ) {
288*f4f33ea0SBaptiste Daroussin                if (
289*f4f33ea0SBaptiste Daroussin                    &rhs_checklistl(
290*f4f33ea0SBaptiste Daroussin                        (
291*f4f33ea0SBaptiste Daroussin                            "A checklist",
292*f4f33ea0SBaptiste Daroussin                            "This checklist uses only the \"tag\" values:",
293*f4f33ea0SBaptiste Daroussin                            $midcols, $#demo_tags + 1
294*f4f33ea0SBaptiste Daroussin                        ),
295*f4f33ea0SBaptiste Daroussin                        @demo_tags
296*f4f33ea0SBaptiste Daroussin                    )
297*f4f33ea0SBaptiste Daroussin                  )
298*f4f33ea0SBaptiste Daroussin                {
299*f4f33ea0SBaptiste Daroussin                    &show_results( "My long-checklist", $midcols );
300*f4f33ea0SBaptiste Daroussin                }
301*f4f33ea0SBaptiste Daroussin            }
302*f4f33ea0SBaptiste Daroussin            elsif ( $testcase eq $RHS_CHECKLISTA ) {
303*f4f33ea0SBaptiste Daroussin                if (
304*f4f33ea0SBaptiste Daroussin                    &rhs_checklista(
305*f4f33ea0SBaptiste Daroussin                        "A checklist",
306*f4f33ea0SBaptiste Daroussin                        "This checklist uses the sorted keys from a hash:",
307*f4f33ea0SBaptiste Daroussin                        $midcols, %demo_hash
308*f4f33ea0SBaptiste Daroussin                    )
309*f4f33ea0SBaptiste Daroussin                  )
310*f4f33ea0SBaptiste Daroussin                {
311*f4f33ea0SBaptiste Daroussin                    &show_results( "My alpha-checklist", $midcols );
312*f4f33ea0SBaptiste Daroussin                }
313*f4f33ea0SBaptiste Daroussin            }
314*f4f33ea0SBaptiste Daroussin            elsif ( $testcase eq $RHS_RADIOLIST ) {
315*f4f33ea0SBaptiste Daroussin                if (
316*f4f33ea0SBaptiste Daroussin                    &rhs_radiolist(
317*f4f33ea0SBaptiste Daroussin                        (
318*f4f33ea0SBaptiste Daroussin                            "A radiolist",
319*f4f33ea0SBaptiste Daroussin                            "This radiolist uses \"tag\" values"
320*f4f33ea0SBaptiste Daroussin                              . " and descriptions:",
321*f4f33ea0SBaptiste Daroussin                            $midcols,
322*f4f33ea0SBaptiste Daroussin                            ( $#demo_3col + 1 ) / 3
323*f4f33ea0SBaptiste Daroussin                        ),
324*f4f33ea0SBaptiste Daroussin                        @demo_3col
325*f4f33ea0SBaptiste Daroussin                    )
326*f4f33ea0SBaptiste Daroussin                  )
327*f4f33ea0SBaptiste Daroussin                {
328*f4f33ea0SBaptiste Daroussin                    &show_results( "My radiolist", $midcols );
329*f4f33ea0SBaptiste Daroussin                }
330*f4f33ea0SBaptiste Daroussin            }
331*f4f33ea0SBaptiste Daroussin        }
332*f4f33ea0SBaptiste Daroussin    }
333*f4f33ea0SBaptiste Daroussin}
334*f4f33ea0SBaptiste Daroussin
335*f4f33ea0SBaptiste Daroussin&doit;
336*f4f33ea0SBaptiste Daroussin
337*f4f33ea0SBaptiste Daroussin1;
338