use Devel::CheckOS qw(os_is); if(os_is('MSWin32')) { eval 'use MyApplication::Platform::Win32'; } elsif(os_is('MacOSX')) { eval 'use MyApplication::Platform::MacOSX'; } else { warn "not MSWin32 or MacOSX, falling back to defaults\n"; eval 'use MyApplication::Platform::Default'; } #### use Win32::File; use Win32::FileSecurity; sub check_dir_is_writeable { my $http_rec_localdir = shift; my $attrib; Win32::File::GetAttributes($http_rec_localdir, $attrib); if ($attrib & (Win32::File::SYSTEM | Win32::File::HIDDEN)) ... } #### sub check_dir_is_writeable { -d $_ && -w $_ && -x $_ } #### if(check_dir_is_writeable($dir)) { # yay! } else { # ohnoes! }