Skip Menu |

This queue is for tickets about the Term-Menus CPAN distribution.

Report information
The Basics
Id: 72041
Status: resolved
Worked: 4 hours (240 min)
Priority: 0/
Queue: Term-Menus

People
Owner: Brian.Kelly [...] fullautosoftware.net
Requestors: marcosgeorge2002 [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 2.02
Fixed in: 2.26



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);
Subject: Re: [rt.cpan.org #72041] Two potential critical bugs
Date: Sat, 12 Nov 2011 10:34:10 -0500
To: bug-Term-Menus [...] rt.cpan.org
From: brian.kelly [...] fullautosoftware.net
Marcos, I am unable to recreate the first error. Are you using the latest Term::Menus? Also what OS are you using? If windows, what perl? Active State? Strawberry? Cygwin? I was able to recreate the second error. I will investigate and let you know. Brian Show quoted text
> Sun Oct 30 02:36:38 2011: Request 72041 was acted upon. > Transaction: Ticket created by marcosgeorge2002@yahoo.com > Queue: Term-Menus > Subject: Two potential critical bugs > Broken in: 2.02 > Severity: Critical > Owner: Nobody > Requestors: marcosgeorge2002@yahoo.com > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=72041 > > > > 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: Re: [rt.cpan.org #72041] Two potential critical bugs
Date: Sat, 12 Nov 2011 16:27:30 -0800 (PST)
To: "bug-Term-Menus [...] rt.cpan.org" <bug-Term-Menus [...] rt.cpan.org>
From: Marcos Georgopoulos <marcosgeorge2002 [...] yahoo.com>
Hi Brian, Thanks for the response. I am running the lasted version. I installed it via cpan. A quick check with cpanminus states it is uptodate as well: marcos@ubuntu:~$ sudo cpanm -i Term::Menus [sudo] password for marcos:  Term::Menus is up to date. (2.02) I am testing on ubuntu: Linux ubuntu 2.6.38-11-generic #50-Ubuntu SMP Mon Sep 12 21:18:14 UTC 2011 i686 i686 i386 GNU/Linux I am running the following version of perl: This is perl, v5.10.1 (*) built for i686-linux-gnu-thread-multi I just ran another test with a different example of CPAN. It seems I am getting an error regarding an undefined subroutine. Could there be something wrong with my setup? I apologise I am fairly new to Perl, so I hope this isn't something silly I'm doing. See below Show quoted text
------ Begin Code Snippet ---------- use Term::Menus; sub selected { print "\n SELECTED ITEM = $_[0]\n" } my %Menu_1=( Label => 'Menu_1', Item_1 => { Text => "/bin/Utility - ]Convey[", Convey => [ `ls -1 /bin` ], Result => "&selected(]Selected[)", }, Select => 'One', Banner => "\n Choose a /bin Utility :" ); my @selections=&Menu(\%Menu_1); print "SELECTIONS=@selections\n";
------ End Code Snippet ----------
------Begin Output -------------------    Choose a /bin Utility :       1. /bin/Utility - bash       2. /bin/Utility - bunzip2       3. /bin/Utility - busybox       4. /bin/Utility - bzcat       5. /bin/Utility - bzcmp       6. /bin/Utility - bzdiff       7. /bin/Utility - bzegrep       8. /bin/Utility - bzexe       9. /bin/Utility - bzfgrep       10. /bin/Utility - bzgrep    131 Total Choices    Press ENTER (or "d") to scroll downward    OR "u" to scroll upward  (Type "quit" to quit)    PLEASE ENTER A CHOICE:   Bareword found where operator expected at (eval 23) line 1, near "0x8b47a::selected" (Missing operator before ::selected?)        FATAL ERROR! - The Local System ubuntu Conveyed               the Following Unrecoverable Error Condition :        Undefined subroutine &Net::FullAuto::FA_Core::handle_error called at /usr/local/share/perl/5.10.1/Term/Menus.pm line 4719.        line 4738 at /usr/local/share/perl/5.10.1/Term/Menus.pm line 4751.
------End Output----------
________________________________ From: Brian Kelly via RT <bug-Term-Menus@rt.cpan.org> To: marcosgeorge2002@yahoo.com Sent: Sunday, 13 November 2011 2:35 AM Subject: Re: [rt.cpan.org #72041] Two potential critical bugs <URL: https://rt.cpan.org/Ticket/Display.html?id=72041 > Marcos, I am unable to recreate the first error. Are you using the latest Term::Menus? Also what OS are you using? If windows, what perl? Active State? Strawberry? Cygwin? I was able to recreate the second error. I will investigate and let you know. Brian
> Sun Oct 30 02:36:38 2011: Request 72041 was acted upon. > Transaction: Ticket created by marcosgeorge2002@yahoo.com >        Queue: Term-Menus >      Subject: Two potential critical bugs >    Broken in: 2.02 >    Severity: Critical >        Owner: Nobody >  Requestors: marcosgeorge2002@yahoo.com >      Status: new >  Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=72041 > > > > 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. > >

Message body is not shown because it is too large.

The two issues/requests have been resolved. The code now works as you have requested. Sorry for the LONG delay. This module must find time in my VERY busy life, and this was the soonest I could devote any kind of substantial effort to getting these issues resolved. Took about 4 concentrated hours of effort. Thanks for using Term::Menus, for your ticket, and again, APOLOGIES for the incredibly long delay. Below is your code slightly revised to be simpler, and in accord with "best practice" for the module. # REVISED CODE BELOW use Term::Menus; sub get_all_versions { return 'LATEST', 'Version 1.0', 'Version 1.1' } sub do_deployment { print "\n We will deploy $_[0]\n"; # return $_[0]; # uncomment this to return the selection } %Menu_5 = ( Label => 'Menu_5', Item_1 => { Text => ']P[{Menu_1}, ]Previous[ to ]Convey[', Convey => [ 'development','testing','qa','production' ], Result => "&do_deployment(]Selected[)", }, Banner => ' Please select the Destination Environment:' ); %Menu_2 = ( Label => 'Menu_2', Item_1 => { Text => ']Previous[, ]Convey[', Convey => [ &get_all_versions() ], Result => \%Menu_5 }, Banner => ' Please select the Version to deploy:' ); %Menu_1 = ( Label => 'Menu_1', Item_1 => { Text => ']C[', 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); print "\n OUTPUT=$output\n";