cleen has asked for the wisdom of the Perl Monks concerning the following question:
my $form = Curses::Forms->new({ 'Y' => 1, 'X' => 0, 'LINES' => $LINES - 2, 'COLS' => $COLS }); $form->add( { 'type' => 'list_box', 'name' => 'Orders', 'ypos' => 0, 'xpos' => 25, 'cols' => ($COLS - 27), 'lines' => 8, 'title' => ' Orders ', 'list' => ["blah" +,"blah2"] }, { 'type' => 'txt_field', 'name' => 'Status', 'ypos' => 10, 'xpos' => 25, 'cols' => $COLS - 27, 'lines' => $LINES - 14, 'title' => ' Status ', 'content' => '(no record selected)' }, { 'type' => 'list_box', 'name' => 'Menu', 'ypos' => 0, 'xpos' => 0, 'cols' => $COLS - 57, 'lines' => $LINES - 4, 'title' => ' Menu ', 'list' => +[], }, ); $form->tab_order(qw( Orders Menu)); $form->bind( ["Orders", "[ \n]", "Mod_Oth", \&get_menu, "Me +nu"], ["Orders", "[\n]", "Nxt_Wdgt"], ["Menu", "[ \n]", "Mod_Oth", \&do_somthing, "S +tatus"], ["Menu", "[hH]", "Mod_Oth", \&get_help, "Menu" +], ["Orders", "[rR]", "Mod_Oth", \&refresh_win, " +Orders"] ); $form->set_defaults ( DEF_FUNC => \&clock); $form->activate();
local *do_somthing = sub { my $list_ref = shift; my $menu_ref = shift; my $status_ref = shift; my $selected; my $blah; my $selected_num = $$menu_ref{'selected'}; my ($id, $menu) = split(/ /,$$menu_ref{'title'}); $selected = $$menu_ref{'list'}{$selected_num}; print "$selected\n"; $selected =~ s/\s+$//g; if ($selected eq "VIEW CONFIGURATION") { $blah = &external_subroutine($id); $$status_ref{"content"} = $blah; } elsif { $$status_ref{"content"} = "HRMM"; } }; ..... ..... ..... outside this whole block of code sub external_subroutine { my $id = @_; # IM THINKING THIS MAY BE THE PROBLEM $id =+ 10; return $id; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Calling External Subroutines from a local sub.
by cleen (Pilgrim) on Apr 09, 2001 at 23:24 UTC | |
|
Re: Calling External Subroutines from a local sub.
by princepawn (Parson) on Apr 09, 2001 at 23:26 UTC |