Curses :: UI ::网格模块

时间:2013-05-12 07:53:31

标签: perl perl-module ncurses

这是perldoc的第一个例子

use Curses::UI;
my $cui = new Curses::UI;
my $win = $cui->add('window_id', 'Window');
my $grid =$win->add(
  'mygrid', 'Grid'
  -rows    => 3,
  -columns => 5,
);

# set header desc 
$grid->set_label("cell$_", "Head $_")
  for (1 .. 5);

# add some data
$grid->set_cell_value("row1", "cell$_", "value $_")
  for 1 .. 5;
my $val = $grid->get_value("row1", "cell2");

这给了我这个致命的恐怖

  Fatal program error:
  --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  Could not load Curses::UI::0 from Curses/UI/0.pm:
  Can't locate Curses/UI/0.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/sha
  re/perl/5.10 /usr/local/lib/site_perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 .) at /usr/share/perl5/Curses/UI.pm line 846.
  --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  Press any key to exit...

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

好的,我已经在我的机器上修复了这个问题。您需要安装以下软件包:

sudo cpan -fi Curses::UI::Widget
sudo cpan -fi Curses::UI::Grid

如果你已经安装了它们,你应该再试一次,因为我还以为我安装了它们,但最终看起来我没有正确地做到这一点而且我遇到了和你一样的错误没有。现在一切正常,希望它会对你有所帮助。