A perl script which would include different modules for both Windows and Linux, In order to make it cross-platform, I want someway to implement it, just like in C++:
#if _WIN32
//...
#else
//...
#endif
A perl script which would include different modules for both Windows and Linux, In order to make it cross-platform, I want someway to implement it, just like in C++:
#if _WIN32
//...
#else
//...
#endif
use if $^O eq 'MSWin32', Win32::Console::ANSI::;
Alternatively,
use Win32::Console::ANSI ();
is equivalent to
BEGIN {
require Win32::Console::ANSI;
}
so you could also use
BEGIN {
require Win32::Console::ANSI
if $^O eq 'MSWin32';
}