Functionally, stat(_) avoids actually doing a second stat. Of course, your gripe may be aesthetic, which this won't help.
>-----Original Message----- >From: Ovid [mailto:[EMAIL PROTECTED] >Sent: Monday, April 16, 2007 11:52 AM >To: [email protected] >Subject: Re: Module name - smoke testing automation > >--- Ovid <[EMAIL PROTECTED]> wrote: > >> $ENV{PATH} = do { >> my $sep = $Config{path_sep}; >> >> join $sep, ( >> map { /(.*)/ } >> grep { stat($_) && !( stat($_)->mode & S_IWOTH ) } >> grep { file_name_is_absolute($_) } >> split( /\Q$sep/, $ENV{PATH} ), >> ); >> }; > >Ugh. I hated my double call to stat(). > > $ENV{PATH} = do { > my $sep = $Config{path_sep}; > > join $sep, ( > map { /(.*)/ } > grep { > local $_ = stat $_; > defined && !( $_->mode & S_IWOTH ) > } > grep { file_name_is_absolute($_) } > split( /\Q$sep/, $ENV{PATH}, -1 ), > ); > }; > >Cheers, >Ovid > >-- > >Buy the book -- http://www.oreilly.com/catalog/perlhks/ >Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/ >
