Here's a little portability quiz for you. Why doesn't this work?
... unless $^O =~ /win/i;
I'm guessing you wanted to match something like 'MSWin32' and not match something like 'Darwin'.
As to what operation you were going to skip if you weren't on Windows, my crystal ball isn't too clear. I used to skip flock on Win95/98/ME since it was (fatally) unsupported, but NT/XP etc do support flock. It's not binmode because you'd be using 'if' rather than 'unless' (or just doing it anyway on all platforms).
Re:Portability
brian_d_foy on 2004-09-05T22:10:00
Yep, that's it. I thought I was pretty slick with that/Win/ thing, until it didn't work on my Powerbook, which sets $^O to "darwin".
That's all. The operation I was trying to skip is no big whoop: just a test that won't work on Windows. It was the intent of the conditional that was interesting, and you got it.:) Re:Portability
jhi on 2004-09-06T11:54:18
Also 'cygwin'.
Re:Portability
brian_d_foy on 2004-09-06T12:24:35
I'd want to skip that one too, though.Re:Portability
jhi on 2004-09-06T13:09:50
> I'd want to skip that one too, though.
In the general case that's a tricky one, of course, since Cygwin can do quite many UNIX tricks, but also some Win32 tricks (and with libwin32 even more of the latter).