How does the Perl script detect if it works in Komodo IDE?

One of the ways I've found is to check if Perl Debugger is loaded if it is defined for a specific ($ DB :: single) and it is assumed that Komodo is active if $ DB :: single is defined.

But it could also mean that the script legitimately works like perl -d under a "standalone" debugger.

#!/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; } 

Sentence

zakovyrya leads to:

 if ( grep( /.*Komodo\ IDE\.app/g, values %INC) ){ say "Komodo is running" } else { say "Komodo is not running" }; 

But is there any other way?


UPDATE today my isKomodo () routine failed. Some research has shown that IT has changed my global path settings from β€œlong” to β€œshort” names (this is under Windows). There nolonger is the string "KOMODO" in the% INC hash.

I am looking for a replacement.

+4
source share
2 answers

What does your% INC contain when running a script under Komodo? There is a good chance that some modules specific to Komodo are loaded. It is better to print your content with:

 use Data::Dumper; print Dumper \%INC; 
+2
source

It seems something like this is easier (for a script to know that it works under Komodo):

 use Modern::Perl; if (exists $ENV{'KOMODO_VERSION'}) { say "Script is running under Komodo $ENV{'KOMODO_VERSION'} !"; } else { say "script is not running in Komodo" } 

UPDATE (by lexu): KOMODO (7) now puts KOMODO_VERSION on Wednesday

+2
source

All Articles