]> git.immae.eu Git - perso/Immae/Projets/Scripts/Public.git/blame - interrogations
Amélioration script comptes
[perso/Immae/Projets/Scripts/Public.git] / interrogations
CommitLineData
5172ecf8
IB
1#!/usr/local/bin/perl
2# The MIT License (MIT)
3#
4# Copyright (c) 2011-2015 Ismaël Bouya http://www.normalesup.org/~bouya/
5#
6# Permission is hereby granted, free of charge, to any person obtaining a copy
7# of this software and associated documentation files (the "Software"), to deal
8# in the Software without restriction, including without limitation the rights
9# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10# copies of the Software, and to permit persons to whom the Software is
11# furnished to do so, subject to the following conditions:
12#
13# The above copyright notice and this permission notice shall be included in
14# all copies or substantial portions of the Software.
15#
16# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22# THE SOFTWARE.
23
24use Switch;
25use strict;
26
27my @table = ();
28my @interros = ();
29my @tablequestion = ();
30my @points = ();
31my %corr_nom ;
32my $interro_courante = 0;
33my $fichier = "notes.dat";
34if($#ARGV == 0) {
35 $fichier = $ARGV[0];
36}
37
38sub ajout_interro {
39 print "Nom de l'interrogation\n";
40 my $interro = <STDIN>;
41 chomp($interro);
42 push(@interros,$interro);
43 push(@tablequestion,[]);
44 push(@table,[]);
45 push(@points,[]);
46 foreach my $key (keys %corr_nom) {
47 push(@{ $corr_nom{$key} }, "Absent" );
48 }
49}
50
51sub ajout_eleve {
52 print "Nom\n";
53 my $nom = <STDIN>;
54 chomp($nom);
55 print "Prénom\n";
56 my $prenom = <STDIN>;
57 chomp($prenom);
58 $corr_nom{$prenom."\n".$nom} = ();
59 for my $i (0..$#interros) {
60 push(@{ $corr_nom{$prenom."\n".$nom} }, "Absent" );
61 }
62}
63
64sub definir_exos {
65 my $interro = shift;
66 my $nbexos = "a";
67 while($nbexos =~ m/\D/) {
68 print "Nombre d'exercices\n";
69 $nbexos = <STDIN>;
70 chomp($nbexos);
71 if($nbexos =~ /\D/) {
72 print "Mauvaise entrée\n";
73 }
74 }
75 if($nbexos == "") {
76 $nbexos = 0;
77 }
78 push(@{ $table[$interro] }, $nbexos);
79 if($nbexos == 0) {
80 push(@{ $tablequestion[$interro] }, "");
81 }
82 for(my $i = 1; $i <= $nbexos; $i++) {
83 my $questions = "a";
84 while($questions =~ m/\D/) {
85 print "Nombre de questions dans l'exercice ",$i,"\n";
86 $questions = <STDIN>;
87 chomp($questions);
88 if($questions =~ /\D/) {
89 print "Mauvaise entrée\n";
90 }
91 }
92 if($questions eq "") {
93 $questions = 0;
94 }
95 if($questions > 1) {
96 push(@{ $table[$interro] }, $questions);
97 for(my $j = 1; $j <= $questions; $j++) {
98 my $ssquestions = "a";
99 while($ssquestions =~ m/\D/) {
100 print "Nombre de sous-questions dans la question ",$i,".",$j,"\n";
101 $ssquestions = <STDIN>;
102 chomp($ssquestions);
103 if($ssquestions =~ /\D/) {
104 print "Mauvaise entrée\n";
105 }
106 }
107 if($ssquestions eq "") {
108 $ssquestions = 0;
109 }
110 if($ssquestions > 1) {
111 push(@{ $table[$interro] }, $j.".".$ssquestions);
112 for(my $k = 1; $k<= $ssquestions; $k++) {
113 push(@{ $tablequestion[$interro] }, $i.".".$j.".".$k);
114 }
115 }
116 else {
117 push(@{ $tablequestion[$interro] }, $i.".".$j);
118 }
119 }
120 }
121 else {
122 push(@{ $tablequestion[$interro] }, $i);
123 }
124 }
125}
126
127sub entrer_notes {
128 my $interro = shift;
129 my $eleve = shift;
130 my @boucle;
131 if($eleve) {
132 @boucle = ($eleve);
133 }
134 else {
135 @boucle = sort sort_alpha keys %corr_nom;
136 }
137 foreach my $key (@boucle) {
138 my $keyt = $key;
139 $keyt =~ s/\n/ /;
140 print $keyt." (mettre A pour indiquer une absence)\n";
141 my @int;
142 if(ref($corr_nom{$key}[$interro]) eq 'ARRAY') {
143 @int = @{$corr_nom{$key}[$interro]};
144 }
145 $corr_nom{$key}[$interro] = ();
146 Interro: for my $i (0..$#{$tablequestion[$interro]}) {
147 my $pourcentage = "a";
148 my $def = 0;
149 if(!@int && $i == 0) {
150 $def = "A";
151 }
152 if(scalar(@int) > 0) {
153 $def = $int[$i];
154 }
155 while($pourcentage =~ m/\D/ || $pourcentage > 100) {
156 if($tablequestion[$interro][$i] =~ m/\D/ ) {
157 print "Pourcentage pour la question ".$tablequestion[$interro][$i]." [".$def."]\n";
158 }
159 else {
160 print "Pourcentage pour l'exercice ".$tablequestion[$interro][$i]." [".$def."]\n";
161 }
162 $pourcentage = <STDIN>;
163 chomp($pourcentage);
164 if($pourcentage eq "") {
165 $pourcentage = $def;
166 }
167 if($pourcentage =~ m/^a$/i) {
168 $corr_nom{$key}[$interro] = "Absent";
169 last Interro;
170 }
171 if($pourcentage =~ /\D/ || $pourcentage > 100) {
172 print "Il faut un pourcentage entre 0 et 100\n";
173 }
174 }
175 push(@{ $corr_nom{$key}[$interro] },$pourcentage);
176 }
177 }
178}
179
180sub entrer_bareme {
181 my $interro = shift;
182 foreach my $nomquestion ( @{ $tablequestion[$interro] } ) {
183 my $point = "a";
184 while($point =~ /[^\d\.]/) {
185 if($nomquestion =~ m/\D/ ) {
186 print "Points pour la question ".$nomquestion."\n";
187 }
188 else {
189 print "Points pour l'exercice ".$nomquestion."\n";
190 }
191 $point = <STDIN>;
192 chomp($point);
193 if($point =~ /[^\d\.]/) {
194 print "Il faut donner un nombre de points\n";
195 }
196 }
197 if($point eq "") {
198 $point = 0;
199 }
200 push(@{ $points[$interro] },$point);
201 }
202}
203
204sub sauver {
205 open FILE, ">".$fichier;
206 foreach my $i (0..$#table) {
207 print FILE $interros[$i]."\n";
208 print FILE "@{ $table[$i] }\n";
209 print FILE "@{ $tablequestion[$i] }\n";
210 print FILE "@{ $points[$i] }\n";
211 }
212 print FILE "\n";
213 foreach my $ligne (keys(%corr_nom)) {
214 print FILE $ligne."\n";
215 foreach my $lig (@{ $corr_nom{$ligne} }) {
216 if($lig eq "Absent") {
217 print FILE "! \n";
218 }
219 else {
220 print FILE "* @$lig\n";
221 }
222 }
223 }
224 print FILE "\n";
225 close FILE;
226}
227
228sub charger {
229 open FILE, $fichier;
230 while(my $int = <FILE>) {
231 if($int eq "\n") { last };
232 chomp($int);
233 push(@interros,$int);
234 $int = <FILE>;
235 chomp($int);
236 push(@table, [ split(/ /, $int) ] );
237 $int = <FILE>;
238 chomp($int);
239 push(@tablequestion, [ split(/ /, $int) ] );
240 $int = <FILE>;
241 chomp($int);
242 push(@points, [ split(/ /, $int) ] );
243
244 }
245 my $int = <FILE>;
246 while(1) {
247 if($int eq "\n") { last };
248 my $intn = <FILE>;
249 chomp($intn);
250 my $key = $int.$intn;
251 $corr_nom{$key} = ();
252 while($intn = <FILE>) {
253 if($intn =~ m/^\*/) {
254 chomp($intn);
255 push(@{ $corr_nom{$key} }, [ split(/ /, substr($intn,2)) ] );
256 }
257 elsif($intn =~ m/^!/) {
258 push(@{ $corr_nom{$key} }, "Absent" );
259 }
260 else {
261 $int = $intn;
262 last;
263 }
264 }
265 }
266 close FILE;
267}
268
269sub sort_alpha {
270 my @p_na = split(/\n/,$a);
271 my @p_nb = split(/\n/,$b);
272 return $p_na[1] cmp $p_nb[1] || $p_na[0] cmp $p_nb[0];
273}
274
275sub export_latex {
276 print "Fichier ?\n";
277 my $f_export = <STDIN>;
278 chomp($f_export);
279 if($f_export eq "") { return 0 };
280 open FILE, ">".$f_export;
281 print FILE "\\documentclass[landscape]{article}\n";
282 print FILE "\\usepackage[T1]{fontenc}\n";
283 print FILE "\\usepackage[utf8]{inputenc}\n";
284 print FILE "\\usepackage{geometry}\n";
285 print FILE "\\geometry{margin=1cm}\n";
286 print FILE "\\begin{document}\n";
287 for my $interro (0..$#table) {
288 print FILE "\\begin{tabular}{|l|";
289 my @exosansq = grep(/^[1-9]\d*$/,@{ $tablequestion[$interro] });
290 print FILE "c|"x (scalar(@{ $tablequestion[$interro] })+$table[$interro][0] - scalar(@exosansq));
291 print FILE "|c|}\n";
292 my @ign = ();
293 my @pts = ();
294 my @max = ();
295 my @min = ();
296 my @somme = ();
297 print FILE "\\multicolumn{",(scalar(@{ $tablequestion[$interro] })+$table[$interro][0] - scalar(@exosansq) + 2),"}{c}{\\Large ".$interros[$interro]."}\\\\\n";
298 if($table[$interro][0] > 0) {
299 print FILE "\\hline\n\t ";
300 for(my $i = 1; $i <= $table[$interro][0]; $i++) {
301 my @b = grep(/^$i/,@{ $tablequestion[$interro] });
302 if(scalar(@b) == 1) {
303 print FILE "& Exercice $i ";
304 }
305 else {
306 print FILE "& \\multicolumn{",scalar(@b)+1,"}{c|}{Exercice ",$i,"} ";
307 }
308 }
309 print FILE "& Total ";
310 print FILE "\\\\\n";
311 print FILE "\\hline\n\t";
312 my $rank = -1;
313 for(my $i = 1; $i <= $table[$interro][0]; $i++) {
314 my @b = grep(/^$i(\D|$)/,@{ $tablequestion[$interro] });
315 for(my $j = 1; $j <= scalar(@b); $j++) {
316 my @c = grep(/^$i\.$j(\D|$)/,@{ $tablequestion[$interro] });
317 $rank += scalar(@c);
318 if(scalar(@c) == 1) {
319 print FILE "& $j) ";
320 }
321 elsif(scalar(@c) > 0) {
322 print FILE "& \\multicolumn{",scalar(@c),"}{c|}{",$j,")} ";
323 }
324 elsif($j == 1) {
325 $rank +=1;
326 push(@ign,$rank+$i-1);
327 #print FILE "& ";
328 }
329 }
330 print FILE "& Total ";
331 push(@pts,$rank);
332 }
333 print FILE "& \\\\\n";
334 }
335 print FILE "\\hline\n\t";
336 print FILE "points ";
337 my $totalexo = 0;
338 my $total = 0;
339 my $nq = 0;
340 for my $i (0.. $#{ $points[$interro] }) {
341 print FILE "& $points[$interro][$i] ";
342 push(@min,$points[$interro][$i]);
343 push(@max,0);
344 push(@somme,0);
345 $totalexo += $points[$interro][$i];
346 $total += $points[$interro][$i];
347 $nq++;
348 if((grep {$_ == $i} @pts) > 0) {
349 if($nq > 1) {
350 print FILE "& $totalexo ";
351 }
352 push(@min,$totalexo);
353 push(@max,0);
354 push(@somme,0);
355 $totalexo = 0;
356 $nq = 0;
357 }
358 }
359 print FILE "& $total ";
360 push(@min,$total);
361 push(@max,0);
362 push(@somme,0);
363 print FILE "\\\\\n";
364 print FILE "\\hline\n\t";
365 print FILE "\\hline\n\t";
366
367 my @sortednotes = sort sort_alpha (keys %corr_nom);
368 #print "@sortednotes";
369 #my $somme = 0;
370 my $nombre_eleves = 0;
371 for my $i (0.. $#sortednotes) {
372 my $np = $sortednotes[$i];
373 $np =~ s/\n/ /;
374 print FILE $np;
375 my @ligne = @{ $corr_nom{$sortednotes[$i]} };
376 if($ligne[$interro] eq "Absent") {
377 print FILE "& \\multicolumn{",scalar(@{ $tablequestion[$interro] })+$table[$interro][0]+1,"}{c|}{Absent}";
378 }
379 else {
380 my @ligneo = @{ $ligne[$interro] };
381 my $totalexo = 0;
382 my $total = 0;
383 $nombre_eleves++;
384 my $k = 0;
385 my $nq = 0;
386 foreach my $l (0.. $#ligneo ) {
387 my $val = sprintf("%.0f",4.*$ligneo[$l]*$points[$interro][$l]/100)/4;
388 print FILE "& ",$val;
389 if($min[$k] > $val) {
390 $min[$k] = $val;
391 }
392 if($max[$k] < $val) {
393 $max[$k] = $val;
394 }
395 $somme[$k] += $val;
396 $k++;
397 $nq++;
398 $totalexo += $val;
399 $total += $val;
400 if((grep {$_ == $l} @pts) > 0) {
401 if($min[$k] > $totalexo) {
402 $min[$k] = $totalexo;
403 }
404 if($max[$k] < $totalexo) {
405 $max[$k] = $totalexo;
406 }
407 $somme[$k] += $totalexo;
408 if($nq > 1) {
409 print FILE "& $totalexo ";
410 }
411 $k++;
412 $totalexo = 0;
413 $nq = 0;
414 }
415 }
416 print FILE "& $total ";
417 if($min[$k] > $total) {
418 $min[$k] = $total;
419 }
420 if($max[$k] < $total) {
421 $max[$k] = $total;
422 }
423 $somme[$k] += $total;
424 $k++;
425 }
426 print FILE "\\\\\n";
427 print FILE "\\hline\n\t";
428 }
429 print FILE "\\hline\n\t";
430 print FILE "Moyenne";
431 for my $l (0.. $#somme) {
432 next if((grep {$_ == $l} @ign) > 0);
433 print FILE "& ".sprintf("%.0f",4.*$somme[$l]/$nombre_eleves)/4;
434 }
435 print FILE "\\\\\n";
436 print FILE "\\hline\n\t";
437 print FILE "Min";
438 for my $l (0.. $#min) {
439 next if((grep {$_ == $l} @ign) > 0);
440 print FILE "& $min[$l]";
441 }
442 print FILE "\\\\\n";
443 print FILE "\\hline\n\t";
444 print FILE "Max";
445 for my $l (0.. $#max) {
446 next if((grep {$_ == $l} @ign) > 0);
447 print FILE "& $max[$l]";
448 }
449 #print FILE "Moyenne & \\multicolumn{",scalar(@{ $tablequestion[$interro] })+$table[$interro][0],"}{c||}{ }";
450 #my $moyenne = sprintf("%.0f",4.*$somme/$nombre_eleves)/4;
451 #print FILE " & $moyenne\\\\\n";
452 print FILE "\\\\\n";
453 print FILE "\\hline\n\t";
454 print FILE "\\end{tabular}\n";
455 print FILE "\\vfill\n";
456 print FILE "\\newpage\n";
457 }
458 print FILE "\\end{document}\n";
459 close FILE;
460}
461
462sub export_csv {
463 my $interro = shift;
464 print "Fichier ?\n";
465 my $f_export = <STDIN>;
466 chomp($f_export);
467 if($f_export eq "") { return 0 };
468 open FILE, ">".$f_export;
469 for my $interro (0..$#table) {
470 print FILE "; ".$interros[$interro]."\n";
471 my @pts = ();
472 my @ign = ();
473 my @max = ();
474 my @min = ();
475 my @somme = ();
476 if($table[$interro][0] > 0) {
477 for(my $i = 1; $i <= $table[$interro][0]; $i++) {
478 my @b = grep(/^$i/,@{ $tablequestion[$interro] });
479 if(scalar(@b) == 1) {
480 print FILE "; Exercice $i ";
481 }
482 else {
483 print FILE "; Exercice $i","; "x scalar(@b);
484 }
485 }
486 print FILE "; Total \n";
487 my $rank = -1;
488 for(my $i = 1; $i <= $table[$interro][0]; $i++) {
489 my @b = grep(/^$i(\D|$)/,@{ $tablequestion[$interro] });
490 for(my $j = 1; $j <= scalar(@b); $j++) {
491 my @c = grep(/^$i\.$j(\D|$)/,@{ $tablequestion[$interro] });
492 $rank += scalar(@c);
493 if(scalar(@c) == 1) {
494 print FILE "; $j) ";
495 }
496 elsif(scalar(@c) > 0) {
497 my $char = "a";
498 for my $num (0..$#c) {
499 print FILE "; $j) ".$char.") ";
500 $char++;
501 }
502 #print FILE "; $j) ","; "x (scalar(@c)-1);
503 }
504 elsif($j == 1) {
505 $rank += 1;
506 push(@ign,$rank+$i-1);
507 #print FILE "; ";
508 }
509 }
510 print FILE "; Total ";
511 push(@pts,$rank);
512 }
513 print FILE "; \n";
514 }
515 print FILE "points ";
516 my $totalexo = 0;
517 my $total = 0;
518 my $nq = 0;
519 for my $i (0.. $#{ $points[$interro] }) {
520 print FILE "; $points[$interro][$i] ";
521 push(@min,$points[$interro][$i]);
522 push(@max,0);
523 push(@somme,0);
524 $totalexo += $points[$interro][$i];
525 $total += $points[$interro][$i];
526 $nq++;
527 if((grep {$_ == $i} @pts) > 0) {
528 if($nq > 1) {
529 print FILE "; $totalexo ";
530 }
531 push(@min,$totalexo);
532 push(@max,0);
533 push(@somme,0);
534 $totalexo = 0;
535 $nq = 0;
536 }
537 }
538 print FILE "; $total ";
539 push(@min,$total);
540 push(@max,0);
541 push(@somme,0);
542 print FILE "\n";
543
544 my @sortednotes = sort sort_alpha (keys %corr_nom);
545 #print "@sortednotes";
546 #my $somme = 0;
547 my $nombre_eleves = 0;
548 for my $i (0.. $#sortednotes) {
549 my $np = $sortednotes[$i];
550 $np =~ s/\n/ /;
551 print FILE $np;
552 my @ligne = @{ $corr_nom{$sortednotes[$i]} };
553 if($ligne[$interro] eq "Absent") {
554 print FILE "; Absent","; "x (scalar(@{ $tablequestion[$interro] })+$table[$interro][0]);
555 }
556 else {
557 my @ligneo = @{ $ligne[$interro] };
558 my $totalexo = 0;
559 my $total = 0;
560 $nombre_eleves++;
561 my $k = 0;
562 my $nq = 0;
563 foreach my $l (0.. $#ligneo ) {
564 my $val = sprintf("%.0f",4.*$ligneo[$l]*$points[$interro][$l]/100)/4;
565 print FILE "; ",$val;
566 if($min[$k] > $val) {
567 $min[$k] = $val;
568 }
569 if($max[$k] < $val) {
570 $max[$k] = $val;
571 }
572 $somme[$k] += $val;
573 $k++;
574 $totalexo += $val;
575 $total += $val;
576 $nq++;
577 if((grep {$_ == $l} @pts) > 0) {
578 if($nq > 1) {
579 print FILE "; $totalexo ";
580 }
581 if($min[$k] > $totalexo) {
582 $min[$k] = $totalexo;
583 }
584 if($max[$k] < $totalexo) {
585 $max[$k] = $totalexo;
586 }
587 $somme[$k] += $totalexo;
588 $k++;
589 $totalexo = 0;
590 $nq = 0;
591 }
592 }
593 print FILE "; $total ";
594 if($min[$k] > $total) {
595 $min[$k] = $total;
596 }
597 if($max[$k] < $total) {
598 $max[$k] = $total;
599 }
600 $somme[$k] += $total;
601 $k++;
602 }
603 print FILE "\n";
604 }
605 print FILE "Moyenne";
606 for my $l (0.. $#somme) {
607 next if((grep {$_ == $l} @ign) > 0);
608 print FILE "; ".sprintf("%.0f",4.*$somme[$l]/$nombre_eleves)/4;
609 }
610 print FILE "\n";
611 print FILE "Min";
612 for my $l (0.. $#min) {
613 next if((grep {$_ == $l} @ign) > 0);
614 print FILE "; $min[$l]";
615 }
616 print FILE "\n";
617 print FILE "Max";
618 for my $l (0.. $#max) {
619 next if((grep {$_ == $l} @ign) > 0);
620 print FILE "; $max[$l]";
621 }
622 #print FILE "Moyenne & \\multicolumn{",scalar(@{ $tablequestion[$interro] })+$table[$interro][0],"}{c||}{ }";
623 #my $moyenne = sprintf("%.0f",4.*$somme/$nombre_eleves)/4;
624 #print FILE " & $moyenne\\\\\n";
625 print FILE "\n";
626 print FILE "\n\n\n";
627 }
628 close FILE;
629}
630
631if(-e $fichier) {
632 &charger();
633}
634
635sub choisir_interro() {
636 while(1) {
637 my $i = 1;
638 my $var;
639 my $message = '';
640 foreach $var ( @interros ) {
641 $message .= $i++.') '.$var."\n";
642 }
643 print $message;
644 $var = <STDIN>;
645 chop($var);
646 if(/\D/ || $var < 1 || $var > $i) {
647 print "Mauvaise entrée\n";
648 next;
649 }
650 $interro_courante = $var-1;
651 last;
652 }
653}
654
655sub editer_eleve() {
656 my $eleve;
657 while(1) {
658 open COL, "| column";
659 my $i = 1;
660 my @eleves = sort sort_alpha keys(%corr_nom);
661 foreach my $eleve_l (@eleves) {
662 my $eleve_lm = $eleve_l;
663 $eleve_lm =~ s/\n/ /;
664 print COL $i++.") ".$eleve_lm."\n";
665 }
666 print COL $i.") Annuler\n";
667 close COL;
668 my $var = <STDIN>;
669 chop($var);
670 if(/\D/ || $var < 1 || $var > $i) {
671 print "Mauvaise entrée\n";
672 next;
673 }
674 elsif( $var == $i ) {
675 return;
676 }
677 $eleve = $eleves[$var-1];
678 last;
679 }
680 my $notes_c = ${$corr_nom{$eleve}}[$interro_courante];
681 if($notes_c == "Absent") {
682 print "Absent à ".$interros[$interro_courante]."\n";
683 }
684 &entrer_notes($interro_courante,$eleve);
685}
686
687sub quitter() {
688 exit 0;
689}
690
691my @actions = ("Ajouter une interro", "Ajouter un élève");
692my @actions_f = (\&ajout_interro,
693 \&ajout_eleve,
694 \&choisir_interro,
695 \&editer_eleve,
696 \&definir_exos,
697 \&entrer_bareme,
698 \&entrer_notes,
699 \&sauver,
700 \&export_latex,
701 \&export_csv,
702 \&quitter,
703 );
704while(1) {
705 if(scalar(@interros)>0) {
706 $actions[2] = "Choisir une interro";
707 $actions[3] = "Éditer les notes d'un élève";
708 $actions[4] = "Définir les exercices de l'interro";
709 $actions[5] = "Définir le barême de l'interro";
710 $actions[6] = "Entrer les notes de l'interro";
711 $actions[7] = "Sauvegarder";
712 $actions[8] = "Exporter en LaTeX";
713 $actions[9] = "Exporter en CSV";
714 }
715
716
717 my $action;
718 while(1) {
719 my $i = 1;
720 my $var;
721 my @vart = ( @actions, 'Quitter' );
722 my $message = 'Interro sélectionnée : '.$interros[$interro_courante]."\n";
723 foreach $var ( @vart ) {
724 $message .= $i++.') '.$var."\n";
725 }
726 print $message;
727 $var = <STDIN>;
728 chop($var);
729 if(/\D/ || $var < 1 || $var > $i) {
730 print "Mauvaise entrée\n";
731 next;
732 }
733 $action = $actions_f[$var-1];
734 last;
735 }
736 &{$action}($interro_courante);
737}
738
739#&export_latex();