>> However, $^O reported cosmo (presumably short for Cosmopolitan Libc) on all platforms. This will cause problems with modules which provide different functionality based on $^O. File::Spec gave good examples of this.
> You can get some indication of the system from POSIX::uname(). The docs for this are hedged about with caveats, but if it returns something germaine you can in theory derive an appropriate value from this and assign it to $^O itself, which (believe it or not) can be modified. This modification must be done at compile time, before any of the affected modules are loaded.
Nice trick, thanks!
% perl -le 'print $^O'
darwin
% ./perl.com -le 'print $^O'
cosmo
% ./perl.com -MPOSIX -le 'BEGIN{@_=POSIX::uname;$^O=lc $_[0]}print $^O'
darwin
% ./perl.com -le 'BEGIN{$^O="MSWin32"}use File::Spec;print for @File::Spec::ISA'
File::Spec::Win32