- or download this
use strict;
sub win_fn { print "windows version of function\n" }
...
}
}
xplatform_fn();
- or download this
use strict;
my $OS_TYPE = $^O eq 'MSWin32' ? 'win' :
...
);
sub xplatform_fn { return $xplat{$OS_TYPE}->() }
xplatform_fn();
- or download this
use strict;
my $OS_TYPE = $^O eq 'MSWin32' ? 'win' :
...
sub XPlat::unix_fn { print "unix version of function\n" }
sub xplatform_fn { return &{$XPlat::{$OS_TYPE."_fn"}} }
xplatform_fn();