Cita:
Iniciado por jferrero En el foro de Perl en Español hemos tratado ese tema, alguna vez.
Por ejemplo,
Menú por consola.
Pero depende del tipo de terminal que vayas a usar.
Uhm... no me funcionó
Código PERL:
Ver original#!/usr/bin/perl
use strict;
use warnings;
use diagnostics;
use Term::Menu;
my $var = 0;
my $sede = 0;
my $prompt = Term::Menu->new(
beforetext => 'Por favor, elija una de las siguientes opciones:',
aftertext => 'Introduzca la sede por favor ',
nooptiontext => 'No seleccionaste ninguna opcion',
toomanytries => 'Inicia el programa nuevamente y pulse alguna tecla por favor ',
);
my $answer = $prompt->menu(
resguardo => ["resguardo", 1 ],
sqlaltas => ["sqlaltas", 2 ],
sqlcronograma => ["sqlcronogramas", 3 ],
Ayuda => ["Ayuda sobre el Programa", 4 ],
Salir => ["Salir del Programa", 5 ],
);
if ($answer eq 'resguardo') {
print "Has elegido sede resguardo "; }
elsif ($answer eq 'sqlaltas') {
print "Has elegido sede sqlaltas "; }
Error que devuelve
Can't locate Term/Menu.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at ./test.pl line 6.
BEGIN failed--compilation aborted at ./test.pl line 6 (#1)
(F) You said to do (or require, or use) a file that couldn't be
found. Perl looks for the file in all the locations mentioned in @INC,
unless the file name included the full path to the file. Perhaps you
need to set the PERL5LIB or PERL5OPT environment variable to say where
the extra library is, or maybe the script needs to add the library name
to @INC. Or maybe you just misspelled the name of the file. See
perlfunc/require and lib.
Uncaught exception from user code:
Can't locate Term/Menu.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at ./test.pl line 6.
BEGIN failed--compilation aborted at ./test.pl line 6.
at ./test.pl line 6
Gracias de antemano