|
|
|
|
 主文件与子文件间如何传递参数? - abmyself [ 2004-10-02 00:42 | 436 byte(s)]
 Re: 主文件与子文件间如何传递参数? - abmyself [ 2004-10-03 17:11 | 229 byte(s)]
 Re: 主文件与子文件间如何传递参数? - abmyself [ 2004-10-07 13:31 | 291 byte(s)]
 Re: 主文件与子文件间如何传递参数? - abmyself [ 2004-10-11 21:53 | 193 byte(s)]
|
|
|
|
[Original]
[Print]
[Top]
|
main.pl:
#!/usr/bin/perl -w
...
foreach $CURRENT_JOB($ALL_JOB){
require("$DEVELOP_DIR/module/get_full_path.pl $CURRENT_JOB"); #这一句是不正确的,我就是想实现类似功能
}
...
能在主程序中将变量以参数形式传递给子程序吗?还有就是我将get_full_path.pl编译后,return($FULL_PATH);在主程序中无法取回此变量.
请教众大侠!
|
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
关键是,我要编译get_full_path.pl 这个文件,一编译后,什么变量都有能return回主程序了,你说如何解决?
因而我想到了参数传递这一方法(以前写csh script时经常用这一招解决远程操作),还请帮忙想个办法.
谢谢!
|
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
可能你的理解有偏差,我重点目的是在如何传递参数,而非只是取一个full_path.
再者,此例中 JOB是指位于一个表中记录的JOB,我根据JOB名取出位于不同Database(位于不同的工作站中)的全路径,
非用MODULE可以取出的,除非自建一个MODULE...
我要问的是如何传递参数!
谢谢!
|
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
You can define a global variable in one file by "our" delaration and get its value in
another file by full name.
For instance, if you do
our $a
in file this.pl,
you can refer it as
$this::a
in another file.
Otherwise, you can try Exporter module. try perldoc Exporter.
... BTW, I still do not know what you want...
|
|
|
----
It's better to burn out than to fade away...
|
|
[Original]
[Print]
[Top]
|
|
|