Front page | perl.perl5.porters |
Postings from December 2016
Re: File::Find on WSL
Thread Previous
|
Thread Next
From:
Uri Guttman
Date:
December 4, 2016 04:33
Subject:
Re: File::Find on WSL
Message ID:
58439C72.4090704@stemsystems.com
On 12/03/2016 11:23 PM, Thorsten Behrens wrote:
>
>
> # These are hard-coded for now, but may move to hint files.
>
> if ($^O eq 'VMS') {
>
> $Is_VMS = 1;
>
> $File::Find::dont_use_nlink = 1;
>
> }
>
> elsif ($^O eq 'MSWin32') {
>
> $Is_Win32 = 1;
>
> }
>
> elsif ($^O eq 'linux') {
>
> open my $pv, '<', '/proc/version' or die "Can't open <
> /proc/version: $!";
>
> my $lv = <$pv>;
>
> if (index($lv,'Microsoft') != -1 || index($lv,'WSL') != -1) {
>
> $File::Find::dont_use_nlink = 1;
>
> }
>
> }
>
this is a general style comment and i don't know the outer context so
take it lightly. i don't like seeing elsif. in too many cases i see it
is just a token checker and a hash/dispatch table is better. i will use
early returns from a sub in cases where that can work. if foo, then
blah, return. the next line is just an if and not elsif. i don't even
like else much. i call this view "eschew else". with perl having great
statement modifiers, many else lines can be eliminated with
next/last/return flow control and simpler logic. this also saves on
pixels which are very costly! :)
uri
PS. anyone want to hire me for projects or full time?
Thread Previous
|
Thread Next