On Mon, Jun 08, 2020 at 12:26:42AM +0300, Peter Pentchev wrote:
> On Mon, Jun 08, 2020 at 12:21:22AM +0300, Peter Pentchev wrote:
> > On Sun, Jun 07, 2020 at 01:57:11PM -0700, ToddAndMargo via perl6-users 
> > wrote:
> > > On 2020-06-07 13:53, Peter Pentchev wrote:
> > > > $path = 'lib1'.IO.d ?? 'lib1' !! 'lib2';
> > > 
> > > Got it!  Thank you!
> > > 
> > > I am not seeing the above enter the proper syntax:
> > > 
> > >     'lib1', 'lib2' etc.
> > > 
> > > Where is the comma?  How are the single quotes entered?
> > 
> > I don't understand what you are asking. The above checks whether
> > a directory exists and, depending on the result of this check, assigns
> > one of two values to a variable. I don't know what comma you are talking
> > about.
> 
> Wait, I think I got it. You're asking about the line underneath, the one
> that you did not quote in this message, the line that says:
> 
>   use lib $path;
> 
> "use lib" expects you to pass a string (or more strings). 'c:/NtUtil' is
> a string.  $path is a variable that holds a string. "use lib $path"
> calls "use lib" and passes to it the string in the variable $path.

So to be a bit more clear, in your case you have a path that you always
need to pass ('c:/something') and another one that you want to pass only
if it exists. OK, so maybe something like:

my @path;

BEGIN { 
        for ('K:/NtUtil', 'X:/NtUtil') -> $candidate {
                push @path, $candidate if $candidate.IO.d;
        }
        push @path, 'C:/NtUtil';
}       

use lib @path;

Maybe something like that will work for you.

G'luck,
Peter

-- 
Peter Pentchev  r...@ringlet.net r...@debian.org p...@storpool.com
PGP key:        http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115  C354 651E EFB0 2527 DF13

Attachment: signature.asc
Description: PGP signature

Reply via email to