Re: Is thre a way to do an "if" on "use lib"?

2020-06-12 Thread Todd Chester via perl6-users
On 2020-06-07 18:49, ToddAndMargo via perl6-users wrote: ~ #!/usr/bin/env raku # Note: this has to be the first thing at the top my @LibPath; BEGIN {    for ('K:/Windows/NtUtil', 'X:/NtUtil') -> $candidate { push @LibPath, $candidate if $candidate.IO.d;  

Re: Is thre a way to do an "if" on "use lib"?

2020-06-07 Thread ToddAndMargo via perl6-users
On 2020-06-07 00:28, ToddAndMargo via perl6-users wrote: Hi All, Is there a way to do an "if" on "use lib", so I do not have to keep commenting these back and forth? # use lib 'C:/NtUtil', '.'; use lib 'C:/NtUtil', '.', 'K:/NtUtil'; Many thanks, -T Follow up: With tons of help from Peter an

Re: Is thre a way to do an "if" on "use lib"?

2020-06-07 Thread ToddAndMargo via perl6-users
On 2020-06-07 14:40, Peter Pentchev wrote: 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: $

Re: Is thre a way to do an "if" on "use lib"?

2020-06-07 Thread Peter Pentchev
On Sun, Jun 07, 2020 at 05:33:43PM -0400, Will Coleda wrote: > On Sun, Jun 7, 2020 at 4:53 PM Peter Pentchev wrote: > > > > On Sun, Jun 07, 2020 at 12:32:09PM -0700, ToddAndMargo via perl6-users > > wrote: > > > On 2020-06-07 02:32, Peter Pentchev wrote: > > > > > > > BEGIN { > > > > $path =

Re: Is thre a way to do an "if" on "use lib"?

2020-06-07 Thread Peter Pentchev
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 ?? 'l

Re: Is thre a way to do an "if" on "use lib"?

2020-06-07 Thread Will Coleda
the URL with literal !! in it didn't work for me, but this does: https://docs.raku.org/language/operators#infix_??_%21%21 On Sun, Jun 7, 2020 at 4:53 PM Peter Pentchev wrote: > > On Sun, Jun 07, 2020 at 12:32:09PM -0700, ToddAndMargo via perl6-users wrote: > > On 2020-06-07 02:32, Peter Pentchev

Re: Is thre a way to do an "if" on "use lib"?

2020-06-07 Thread Peter Pentchev
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 abo

Re: Is thre a way to do an "if" on "use lib"?

2020-06-07 Thread ToddAndMargo via perl6-users
On 2020-06-07 12:32, ToddAndMargo via perl6-users wrote: n 2020-06-07 02:32, Peter Pentchev wrote: BEGIN { $path = 'lib1'.IO.d ?? 'lib1' !! 'lib2'; } Does the final "}" close the BEGIN? Hi Peter, I am so use to BEGIN ... END In other languages, that I had to ask. Modula2 i

Re: Is thre a way to do an "if" on "use lib"?

2020-06-07 Thread Peter Pentchev
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 com

Re: Is thre a way to do an "if" on "use lib"?

2020-06-07 Thread ToddAndMargo via perl6-users
On 2020-06-07 13:57, 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

Re: Is thre a way to do an "if" on "use lib"?

2020-06-07 Thread ToddAndMargo via perl6-users
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? -T

Re: Is thre a way to do an "if" on "use lib"?

2020-06-07 Thread Peter Pentchev
On Sun, Jun 07, 2020 at 12:32:09PM -0700, ToddAndMargo via perl6-users wrote: > On 2020-06-07 02:32, Peter Pentchev wrote: > > > BEGIN { > > $path = 'lib1'.IO.d ?? 'lib1' !! 'lib2'; > > } > > Does the final "}" close the BEGIN? Well, there is an opening { after "BEGIN", so, yes. More precis

Re: Is thre a way to do an "if" on "use lib"?

2020-06-07 Thread ToddAndMargo via perl6-users
On 2020-06-07 02:32, Peter Pentchev wrote: BEGIN { $path = 'lib1'.IO.d ?? 'lib1' !! 'lib2'; } Does the final "}" close the BEGIN? $path = 'lib1'.IO.d ?? 'lib1' !! 'lib2'; Hi Peter, Would you explain what the ?? and !! are doing in the above? Many thanks, -T

Re: Is thre a way to do an "if" on "use lib"?

2020-06-07 Thread Peter Pentchev
On Sun, Jun 07, 2020 at 11:37:43AM +0200, JJ Merelo wrote: > El dom., 7 jun. 2020 a las 11:32, Peter Pentchev () > escribió: > > > On Sun, Jun 07, 2020 at 12:28:36AM -0700, ToddAndMargo via perl6-users > > wrote: > > > Hi All, > > > > > > Is there a way to do an "if" on "use lib", so > > > I do no

Re: Is thre a way to do an "if" on "use lib"?

2020-06-07 Thread JJ Merelo
Also, you can simply issue different -I arguments when you invoke the script; you can put that in a shell or whatever script raku -Imy/lib script for your own lib raku -Iother/lib script for other (or Windows equivalent). No need to use Raku to change the path, actually. El dom., 7 jun. 2020

Re: Is thre a way to do an "if" on "use lib"?

2020-06-07 Thread Peter Pentchev
On Sun, Jun 07, 2020 at 12:28:36AM -0700, ToddAndMargo via perl6-users wrote: > Hi All, > > Is there a way to do an "if" on "use lib", so > I do not have to keep commenting these back and forth? > > # use lib 'C:/NtUtil', '.'; > use lib 'C:/NtUtil', '.', 'K:/NtUtil'; "use lib" is evaluated quite

Re: Is thre a way to do an "if" on "use lib"?

2020-06-07 Thread ToddAndMargo via perl6-users
On 2020-06-07 01:39, JJ Merelo wrote: No, there's no else. This if is for using modules with different names. If you want to use modules in different paths, it's probably not a good idea to call them by the same name. You can call them different names (and do a use lib on all paths), or use oth

Re: Is thre a way to do an "if" on "use lib"?

2020-06-07 Thread JJ Merelo
No, there's no else. This if is for using modules with different names. If you want to use modules in different paths, it's probably not a good idea to call them by the same name. You can call them different names (and do a use lib on all paths), or use other mechanisms to differentiate them, such

Re: Is thre a way to do an "if" on "use lib"?

2020-06-07 Thread ToddAndMargo via perl6-users
On 2020-06-07 00:55, ToddAndMargo via perl6-users wrote: El dom., 7 jun. 2020 a las 9:29, ToddAndMargo via perl6-users (mailto:perl6-users@perl.org>>) escribió:     Hi All,     Is there a way to do an "if" on "use lib", so     I do not have to keep commenting these back and forth?     # use l

Re: Is thre a way to do an "if" on "use lib"?

2020-06-07 Thread ToddAndMargo via perl6-users
El dom., 7 jun. 2020 a las 9:29, ToddAndMargo via perl6-users (mailto:perl6-users@perl.org>>) escribió: Hi All, Is there a way to do an "if" on "use lib", so I do not have to keep commenting these back and forth? # use lib 'C:/NtUtil', '.'; use lib 'C:/NtUtil', '.', 'K:/NtU

Re: Is thre a way to do an "if" on "use lib"?

2020-06-07 Thread JJ Merelo
Unsurprisingly, there is "if": https://github.com/FROGGS/p6-if Install it with zef install if And then... use if; # activate the :if adverb on use statements use My::Linux::Backend:if($*KERNEL.name eq 'linux');use My::Fallback::Backend:if($*KERNEL.name ne 'linux'); El dom., 7 jun. 2020 a las

Is thre a way to do an "if" on "use lib"?

2020-06-07 Thread ToddAndMargo via perl6-users
Hi All, Is there a way to do an "if" on "use lib", so I do not have to keep commenting these back and forth? # use lib 'C:/NtUtil', '.'; use lib 'C:/NtUtil', '.', 'K:/NtUtil'; Many thanks, -T