PERL副程式回存值问题.. 谢谢赐教
GENESIS-SCRIPTS中,我用PERL执行副程式.回存GENESIS时....
回贴时值为: TK::Entry=HASH(0x1d80424) 请问为什么呢? 请高手赐教.谢谢
部份程式码 如下:
$mw->title("程式");$mw->Button(-text => "离开", -command =>sub{exit})->pack(-side =>'bottom');$mw->Button(-text => "执行", -command =>\&addtxt)->pack(-side =>'bottom');
$e1=$mw->Entry(-textvariable=>$e1)->pack(-side =>'bottom');
MainLoop;
sub addtxt {$f->COM(add_text, attributes => "no", type => string, x =>1, y =>1, text => $e1, x_size => 0.1, y_size => 0.1, w_factor => 0.5, polarity => positive, angle => 0, mirror => "no", fontname => standard, ver => 1);exit;}
以下是引用justwin在2005-5-4 15:41:53的发言:
GENESIS-SCRIPTS中,我用PERL执行副程式.回存GENESIS时....
回贴时值为: TK::Entry=HASH(0x1d80424) 请问为什么呢? 请高手赐教.谢谢
部份程式码 如下:
$mw->title("程式");$mw->Button(-text => "离开", -command =>sub{exit})->pack(-side =>'bottom');$mw->Button(-text => "执行", -command =>\&addtxt)->pack(-side =>'bottom');
$e1=$mw->Entry(-textvariable=>$e1)->pack(-side =>'bottom');
MainLoop;
sub addtxt {$f->COM(add_text, attributes => "no", type => string, x =>1, y =>1, text => $e1, x_size => 0.1, y_size => 0.1, w_factor => 0.5, polarity => positive, angle => 0, mirror => "no", fontname => standard, ver => 1);exit;}
$e1=$mw->Entry(-textvariable=>$e1)->pack(-side =>'bottom');既然要宣告$e1为新的变数,那为何文字变数也设为$e1 ?
建议修改如下:
$e1="";
$e2=$mw->Entry(-textvariable=>\$e1)->pack(-side =>'bottom');
还有附程式内要加上防呆!
if (defined $e1 and $e1 ne "") {
Do something!
}
副程式回传值建议用return
最后$e2若没用到就不要指定,不然系统会提示你有一个多余变数没用到!
恭喜你! 你终于将perl装好了!
谢谢 小编赐教. 我的perl装了半年时间才ok.
再次谢谢 mizuno小编.
没学过perl还在学shell
请教小编大人:
my $mw = MainWindow->new;
MainWindow尺寸如何放大呢?因为视示时太小了. 谢谢
请教小编一个问题,在GENESIS里用PERL能否也可像用FORM一样,在对GENESIS图型操作的同时也可对PERL的GUI图型操作呢?,谢谢!
好像可以.需使用perl的图形模组程式.
abcgac兄:可否贴一个form的程式上来呢?请给我参考一下.谢谢您.
