Re: How to read a particular environmental variable?
On 2020-04-08 19:46, ToddAndMargo via perl6-users wrote: And %*ENV raku -e "say %*ENV;" (Any) My bad: %windir% is lower case raku -e "say %*ENV;" C:\WINDOWS Trait:Env still does not work: raku -e "use Trait::Env; my $windir is env; say $windir;" (Any)
Re: How to read a particular environmental variable?
On 2020-04-07 23:56, Simon Proctor wrote: > You might want to take a look at Trait::Env, partly because I've not > tested it in Windows and I'd be interested to know if it works well. https://modules.raku.org/dist/Trait::Env:cpan:SCIMON On Wed, 8 Apr 2020 at 09:22, ToddAndMargo via perl6-users Not sure what he is trying to do. :-( On 2020-04-08 01:44, Simon Proctor wrote: Well he is me so let my try and explain. The idea is to be able to simply assign Env vars to variables so for example you might do " my $windir is env; And then $windir should be assigned the value of the %*ENV variable at runtime. Hi Simon, Well Trait::Env installed with zef in Windows10-1909. I am not seeing the utility of use Trait::Env; my $windir is env; say $windir; versus my $windir=%*ENV; say $windir; And something is wrong. First a Fedora test: $ raku -e 'say %*ENV;' /home/todd now a double check of Windows: echo %WINDIR% C:\WINDOWS Now for Trait::Env raku -e "use Trait::Env; my $windir is env; say $windir;" (Any) raku -e "use Trait::Env; my $WINDIR is env; say $WINDIR;" (Any) And %*ENV raku -e "say %*ENV;" (Any) raku -e "my $windir=%*ENV; say $windir" (Any) There's a bunch of other stuff in it too, it's mostly intended to make Docker environment setup easy to use but should be useful in other areas. No clue about Docker. I use qemu-kvm How could I make the documentation easier to understand? It is not you; it is me. I can be thick as a stone at times. -T
Re: How to read a particular environmental variable?
On 2020-04-07 23:56, Simon Proctor wrote: > You might want to take a look at Trait::Env, partly because I've not > tested it in Windows and I'd be interested to know if it works well. https://modules.raku.org/dist/Trait::Env:cpan:SCIMON > On Wed, 8 Apr 2020 at 09:22, ToddAndMargo via perl6-users Not sure what he is trying to do. :-( On 2020-04-08 01:44, Simon Proctor wrote: Well he is me so let my try and explain. The idea is to be able to simply assign Env vars to variables so for example you might do " my $windir is env; And then $windir should be assigned the value of the %*ENV variable at runtime. Hi Simon, Well Trait::Env installed with zef in Windows10-1909. I am not seeing the utility of use Trait::Env; my $windir is env; say $windir; versus my $windir=%*ENV; say $windir; And something is wrong. First a Fedora test: $ raku -e 'say %*ENV;' /home/todd now a double check of Windows: echo %WINDIR% C:\WINDOWS Now for Trait::Env raku -e "use Trait::Env; my $windir is env; say $windir;" (Any) raku -e "use Trait::Env; my $WINDIR is env; say $WINDIR;" (Any) And %*ENV raku -e "say %*ENV;" (Any) raku -e "my $windir=%*ENV; say $windir" (Any) -T There's a bunch of other stuff in it too, it's mostly intended to make Docker environment setup easy to use but should be useful in other areas. No clue about Docker. I use qemu-kvm How could I make the documentation easier to understand? It is not you; it is me. I can be thick as a stone at times. -T
Re: How to read a particular environmental variable?
Well he is me so let my try and explain. The idea is to be able to simply assign Env vars to variables so for example you might do use Trait::Env; my $windir is env; And then $windir should be assigned the value of the %*ENV variable at runtime. There's a bunch of other stuff in it too, it's mostly intended to make Docker environment setup easy to use but should be useful in other areas. How could I make the documentation easier to understand? On Wed, 8 Apr 2020 at 09:22, ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > >> On Wed, 8 Apr 2020, 03:25 ToddAndMargo via perl6-users, > >> mailto:perl6-users@perl.org>> wrote: > >> > >> On 2020-04-07 18:25, Brad Gilbert wrote: > >> > Of course %*ENV is case sensitive, hashes are case sensitive. > >> > > >> > say %*ENV.^name; # Hash > >> > > >> > %*ENV gets populated with the values before your code runs. > >> > Other than that it is fairly ordinary. > >> > >> My purpose for the case sensitive remark was that > >> environmental variables are not case sensitive in > >> Windows. And I do not know how Raku interacts with > >> them. > >> > >> >echo %WINDIR% > >> C:\WINDOWS > >> > >> >echo %windir% > >> C:\WINDOWS > >> > >> >echo %WinDir% > >> C:\WINDOWS > > On 2020-04-07 23:56, Simon Proctor wrote: > > You might want to take a look at Trait::Env, partly because I've not > > tested it in Windows and I'd be interested to know if it works well. > > https://modules.raku.org/dist/Trait::Env:cpan:SCIMON > > Not sure what he is trying to do. :-( > -- Simon Proctor Cognoscite aliquid novum cotidie http://www.khanate.co.uk/
Re: How to read a particular environmental variable?
On Wed, 8 Apr 2020, 03:25 ToddAndMargo via perl6-users, mailto:perl6-users@perl.org>> wrote: On 2020-04-07 18:25, Brad Gilbert wrote: > Of course %*ENV is case sensitive, hashes are case sensitive. > > say %*ENV.^name; # Hash > > %*ENV gets populated with the values before your code runs. > Other than that it is fairly ordinary. My purpose for the case sensitive remark was that environmental variables are not case sensitive in Windows. And I do not know how Raku interacts with them. >echo %WINDIR% C:\WINDOWS >echo %windir% C:\WINDOWS >echo %WinDir% C:\WINDOWS On 2020-04-07 23:56, Simon Proctor wrote: You might want to take a look at Trait::Env, partly because I've not tested it in Windows and I'd be interested to know if it works well. https://modules.raku.org/dist/Trait::Env:cpan:SCIMON Not sure what he is trying to do. :-(
Re: How to read a particular environmental variable?
You might want to take a look at Trait::Env, partly because I've not tested it in Windows and I'd be interested to know if it works well. On Wed, 8 Apr 2020, 03:25 ToddAndMargo via perl6-users, < perl6-users@perl.org> wrote: > On 2020-04-07 18:25, Brad Gilbert wrote: > > Of course %*ENV is case sensitive, hashes are case sensitive. > > > > say %*ENV.^name; # Hash > > > > %*ENV gets populated with the values before your code runs. > > Other than that it is fairly ordinary. > > My purpose for the case sensitive remark was that > environmental variables are not case sensitive in > Windows. And I do not know how Raku interacts with > them. > > >echo %WINDIR% > C:\WINDOWS > > >echo %windir% > C:\WINDOWS > > >echo %WinDir% > C:\WINDOWS >
Re: How to read a particular environmental variable?
On 2020-04-07 18:25, Brad Gilbert wrote: Of course %*ENV is case sensitive, hashes are case sensitive. say %*ENV.^name; # Hash %*ENV gets populated with the values before your code runs. Other than that it is fairly ordinary. My purpose for the case sensitive remark was that environmental variables are not case sensitive in Windows. And I do not know how Raku interacts with them. >echo %WINDIR% C:\WINDOWS >echo %windir% C:\WINDOWS >echo %WinDir% C:\WINDOWS
Re: How to read a particular environmental variable?
Of course %*ENV is case sensitive, hashes are case sensitive. say %*ENV.^name; # Hash %*ENV gets populated with the values before your code runs. Other than that it is fairly ordinary. On Tue, Apr 7, 2020 at 7:20 PM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > >> On Tue, Apr 7, 2020 at 6:48 PM ToddAndMargo via perl6-users > >> mailto:perl6-users@perl.org>> wrote: > >> > >> Hi All, > >> > >> $ raku -e 'say %*ENV;' > >> > >> Gives me ALL of them. Is there a way to just ask for > >> a particular one, such as %appdata%, or %userprofile% > >> in Windows or $HOME is Linux? > >> > >> Many thanks, > >> -T > >> > > On 2020-04-07 16:05, Gerard ONeill wrote: > > It’s still a hash — the * twigil tweaks it’s scope, but it is still a % > > — so %*ENV works (windows) > > > > > Hi Gerald, > > Ah Ha! Thank you! > > Windows 10: > > raku -e "say %*ENV;" > C:\Users\todd\AppData\Roaming > > > Fedora: > $ raku -e 'say %*ENV;' > /home/tony > > Oh, and both WIndows and Fedora (Linux) are case > sensititive > > Love Hashes. My favorite variable structure. > > -T >
Re: How to read a particular environmental variable?
On Tue, Apr 7, 2020 at 6:48 PM ToddAndMargo via perl6-users mailto:perl6-users@perl.org>> wrote: Hi All, $ raku -e 'say %*ENV;' Gives me ALL of them. Is there a way to just ask for a particular one, such as %appdata%, or %userprofile% in Windows or $HOME is Linux? Many thanks, -T On 2020-04-07 16:05, Gerard ONeill wrote: It’s still a hash — the * twigil tweaks it’s scope, but it is still a % — so %*ENV works (windows) Hi Gerald, Ah Ha! Thank you! Windows 10: raku -e "say %*ENV;" C:\Users\todd\AppData\Roaming Fedora: $ raku -e 'say %*ENV;' /home/tony Oh, and both WIndows and Fedora (Linux) are case sensititive Love Hashes. My favorite variable structure. -T
Re: How to read a particular environmental variable?
It’s still a hash — the * twigil tweaks it’s scope, but it is still a % — so %*ENV works (windows) On Tue, Apr 7, 2020 at 6:48 PM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > Hi All, > > $ raku -e 'say %*ENV;' > > Gives me ALL of them. Is there a way to just ask for > a particular one, such as %appdata%, or %userprofile% > in Windows or $HOME is Linux? > > Many thanks, > -T >
How to read a particular environmental variable?
Hi All, $ raku -e 'say %*ENV;' Gives me ALL of them. Is there a way to just ask for a particular one, such as %appdata%, or %userprofile% in Windows or $HOME is Linux? Many thanks, -T