Can a Perl script determine if it works under Activestate vs Strawberry Perl?

I have a Perl script I'm still trying to debug, and in the process I noticed that it works differently under ActivePerl and Strawberry Perl.

This made me wonder how a Perl script can detect which of these flavors it works under.

+3
source share
3 answers

ActivePerl on Windows always (or at least with Perl 5.005) defines a function Win32::BuildNumber(), so you can check it at runtime:

if (defined &Win32::BuildNumber) {
    say "This is ActivePerl";
}
else {
    say "This is NOT ActivePerl";
}

ActivePerl , ActivePerl::BUILD(). ActivePerl 5.8.7 build 814, .

+2

, perls

perl -V

, , , Config. :

perl -MConfig -MData::Dump -e "dd \%Config"
+7

ActiveState Perl, 813.1 ActivePerl ( - ), Perl, , . , Strawberry Perl 5.20.1 . , , , script ActiveState Perl:

if (exists $::{'ActivePerl::'}) {
  # getting called through ActiveState Perl
} else {
  # not getting called through ActiveState Perl
}

ActivePerl . http://docs.activestate.com/activeperl/5.8/lib/ActivePerl.html.

+1
source

All Articles