我有一个Perl脚本,它使用一个不常见的模块,我希望它可以在没有安装该模块的情况下使用,尽管功能有限.可能吗?
我想到了这样的事情:
my $has_foobar; if (has_module "foobar") { << use it >> $has_foobar = true; } else { print STDERR "Warning: foobar not found. Not using it.\n"; $has_foobar = false; }