我发现的一种方法是通过检查
已定义($db::single)
假设Komodo是活动的,如果定义了$db::single。
但这也可能意味着脚本的合法运行方式
Perl—D
在“独立”调试器下。
#!/usr/local/ActivePerl-5.10/bin/perl
use strict;
use warnings;
use feature qw/say switch/;
# detect debugger ..
SayDebugerStatus();
sub SayDebugerStatus {
print "Debugger ";
given ($DB::single) {
when (undef) {
say "not loaded.";
}
when (0) {
say "loaded but inactive";
}
default {
say "loaded and active";
}
}
return defined($DB::single) ? 1:0;
}
扎科夫里亚
他的建议导致:
if ( grep( /.*Komodo\ IDE\.app/g, values %INC) ){
say "Komodo is running"
} else {
say "Komodo is not running"
};
但是还有别的办法吗?
更新
今天我的iskomodo()程序失败了。一些调查显示,它将我的全局路径设置从“long”改为“short”(这在Windows下)。%inc哈希中没有“komodo”字符串。
我在找替代品。