Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
help
madmax
my($iwperl) = ($^O ne "MSWin32") ? "" : "$iwhome/iw-perl/bin/iwperl ";
what does this line tells us? specially "$^O"
Find more posts tagged with
Comments
gzevin
actually, this is a real RTFM.
from perl docs:
$^O
The name of the operating system under which this copy of Perl was built, as determined during the configuration process.
so, the lines checks whether the code was built in windows and takes appropriate action
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU
Adam Stoller
$^O is a built-in perl variable that contains a string indicating the operating system on which the script is being run. "MSWin32" is the string used for (I believe) all Windows OS platforms - so the translation of that line is:
If we are NOT on a Windows platform, set the variable $iwperl to the empty string (""), otherwise (if we ARE on Windows) set it to "$iwhome/iw-perl/bin/iwperl"
The *reason* why you would see a line like this is because Unix-based systems depend on (a) the script being referenced having its execute-bit set and (b) the #! [shebang] line at the beginning of the referenced script to identify the location of the Perl engine -- but Windows does NOT do that, and so you need to tell Windows to explicitly use the Perl engine to run the referenced script.
By "referenced script" I mean that somewhere else within the code you will see something like `$iwperl some_script.ipl` where "some_script.ipl" is the referenced script.
Comprende?
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com