是否可以在 Perl 中在运行时加载模块?我尝试了以下方法,但没有成功。我在程序的某个地方写了以下内容:
require some_module;
import some_module ("some_func");
some_func;
Foo.pm
package Foo;
use strict;
use warnings;
use Exporter qw(import);
our @EXPORT = qw(bar);
sub bar { print "bar(@_)\n" }
1;
脚本.pl
use strict;
use warnings;
require Foo;
Foo->import('bar');
bar(1, 22, 333);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)