Subject: | Two potential critical bugs |
Hi Brian,
I just wanted to start by saying a big thank you for you Term:Menus module. I am fairly new to
Perl and this module has come in very handy.
However I thought you might want to know about to 'potential' bugs I have come across. I
apologise in advance if I am wrong. I'm just trying to help by identifying issues.
The first issue is when I try to call a subroutine as part of a "Result" I get the following error:
" PLEASE ENTER A CHOICE:
Bareword found where operator expected at (eval 24) line 1, near "0x9ed78::do_deployment"
(Missing operator before ::do_deployment?)"
I have attached the full sample code I'm running( which i found online when looking for some
more examples)
The second thing I noticed is that if I call a menu more than once through a while that the
"Select => 'Many'" option doesn't work the next time I call the menu. I want to do this because
I want to keep on running the menu unless the user explicitly asks to 'quit'.
See my code below for an example.
<---BEGIN CODE--->
sub get_all_tables { return 'User', 'Address, 'Device' }
my %dbTables = (
Label => 'DB Tables',
Select => 'Many',
Banner => $heredoc,
Item_1 => {
Text => ']Previous[ ]Convey[',
Convey => [ &get_all_tables() ],
},
);
my %findPath = (
Label => 'Find Path',
Select => 'One',
Banner => $heredoc,
Item_1 => {
Text => 'Text',
},
Item_2 => {
Text => 'Visual',
},
Item_3 => {
Text => 'Debug',
},
);
my %dbmanagement = (
Label => 'DB',
Select => 'One',
Banner => $heredoc,
Item_1 => {
Text => 'Delete',
Convey => 'Delete',
Result => \%dbTables,
},
Item_2 => {
Text => 'Show',
Convey => 'Show',
Result => \%dbTables,
},
);
my %main_menu = (
Label => 'Main Menu',
Select => 'One',
Banner => $heredoc,
Item_1 => {
Text => 'Find Path',
},
Item_2 => {
Text => 'IP Info',
},
Item_4 => {
Text => 'Import Devices',
Result => \%dbmanagement,
},
Item_3 => {
Text => 'Database Management',
Result => \%dbmanagement,
},
);
my @selections = &Menu(\%main_menu);
#run until the 'quit' command is selected
while ( "]quit[" ne "@selections" )
{
#Do some work on @selections
#Call the menu again
@selections = &Menu(\%main_menu);
}
<----End Code---->
Many thanks for your time and this great module.
Marcos G.
Subject: | menu2.pl |
use Term::Menus;
sub get_all_versions { return 'LATEST', 'Version 1.0', 'Version 1.1' }
sub do_deployment {
print "We will deploy $_[0], $_[1] to $_[2]\n"
}
%Menu_5 = (
Label => 'Menu_5',
Item_1 => {
Text => 'Deploy ]P[{Menu_1}, ]Previous[ to ]Convey[',
Convey => [ 'development','testing','qa','production' ],
Result => "&do_deployment( ]Previous[{Menu_1}, ]P[, ]Selected[ )",
},
Banner => ' Please select the Destination Environment:'
);
%Menu_2 = (
Label => 'Menu_2',
Item_1 => {
Text => 'Deploy ]Previous[, ]Convey[',
Convey => [ &get_all_versions() ],
Result => \%Menu_5
},
Banner => ' Please select the Version to deploy:'
);
%Menu_1 = (
Label => 'Menu_1',
Item_1 => {
Text => 'Deploy Java',
Convey => 'Java',
Result => \%Menu_2
},
Select => 'One', # Can be left out - default setting is 'One'
Banner => ' Please select the components to deploy:'
);
my @output=Menu(\%Menu_1);