Re: How to read a particular environmental variable?

2020-04-08 Thread ToddAndMargo via perl6-users

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?

2020-04-08 Thread ToddAndMargo via perl6-users

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?

2020-04-08 Thread ToddAndMargo via perl6-users

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


flash drive launch on insert?

2020-04-08 Thread ToddAndMargo via perl6-users

Hi All,

This is a long shot, but have any of you written
a Windows program that will detect when a flash
drive has been inserted?

https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-registerdevicenotificationw


Many thanks,
-T


Re: How to read a particular environmental variable?

2020-04-08 Thread Simon Proctor
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: zef and tar.gz

2020-04-08 Thread ToddAndMargo via perl6-users

On 2020-04-05 17:30, ToddAndMargo via perl6-users wrote:

On 2020-03-23 21:28, ToddAndMargo via perl6-users wrote:

Hi All,

What is this all about?  Rakudo Star forget
another dependency?  psunzip?

Windows 7, x64 SP1

K:\Windows\NtUtil>raku -v
This is Rakudo version 2020.01 built on MoarVM version 2020.01.1 
implementing Perl 6.d.



K:\Windows\NtUtil>zef install OAuth2::Client::Google
===> Searching for: OAuth2::Client::Google

Enabled extracting backends [git path psunzip] don't understand 
C:\Users\todd/.zef/tmp\1585022838.2848..088006717173\OAuth2-Client-Google-0.1.1.tar.gz 



You may need to configure one of the following backends, or install 
its underlying software - [tar p5tar unzip]



Many thanks,
-T


I opened

git path psunzip failure in Windows 7, but not 10:
https://github.com/ugexe/zef/issues/341


They closed it.  Rats.

The only workaround to them not fixing the problem
is to manually download the module and do a
`zef install .` on it.

And W7 and W10 have both tar and unzip installed in the
same location (C:\Program Files\Git\usr\bin) and neither
have p5tar installed.


Re: How to read a particular environmental variable?

2020-04-08 Thread ToddAndMargo via perl6-users
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: Dropbox and IO?

2020-04-08 Thread Shlomi Fish
On Tue, 7 Apr 2020 11:29:18 -0500
Stephen Wilcoxon  wrote:

> Dropbox on Windows is a real directory.  It is just monitored by the
> Dropbox software and files (or possibly pieces - not sure) are uploaded and
> downloaded when necessary to keep them in sync with the server.
> 

Thanks for the investigation and info, Stephen!

> On Tue, Apr 7, 2020 at 2:40 AM Simon Proctor 
> wrote:
> 
> > Ok I don't have access to my windows box until this evening. I'm mostly
> > used to using Dropbox on a Linux box where it's just a folder.
> >
> > Sorry for my mistake.
> >
> > On Tue, 7 Apr 2020 at 07:51, Shlomi Fish  wrote:
> >  
> >> Hi Simon,
> >>
> >> On Tue, 7 Apr 2020 06:55:00 +0100
> >> Simon Proctor  wrote:
> >>  
> >> > Don't see why not, Dropbox is just a folder that you should be able to
> >> > access as normal.
> >> >  
> >>
> >> Is it a higher-level folder or a bona-fide filesystem direcory:
> >>
> >> https://en.wikipedia.org/wiki/Directory_(computing)#Folder_metaphor
> >>
> >> If it is not visible to the filesystem, one may need higher level APIs
> >> other
> >> than fopen ( https://en.cppreference.com/w/c/io/fopen ) and friends.
> >>  
> >> > On Tue, 7 Apr 2020, 02:22 ToddAndMargo via perl6-users, <
> >> > perl6-users@perl.org> wrote:
> >> >  
> >> > > Hi All,
> >> > >
> >> > > Do any of you using Windows and Dropbox know
> >> > > if Raku's file IO utilities can both read
> >> > > and write to a Drop Box drive?
> >> > >
> >> > > Many thanks,
> >> > > -T
> >> > >  
> >>
> >>
> >>
> >> --
> >>
> >> Shlomi Fish   https://www.shlomifish.org/
> >> https://www.shlomifish.org/open-source/resources/tech-tips/
> >>
> >> How many “one-liners” do I actually write? I don’t know; maybe a couple
> >> dozen
> >> a day. But I guess I must be unusual, because as we all know, AWK was a
> >> complete failure and vanished into obscurity since it didn’t address
> >> anyone’s
> >> real needs. (That was sarcasm.) — “Twelve Views of Mark Jason Dominus”
> >>
> >> Please reply to list if it's a mailing list post - https://shlom.in/reply
> >> .
> >>  
> >
> >
> > --
> > Simon Proctor
> > Cognoscite aliquid novum cotidie
> >
> > http://www.khanate.co.uk/
> >  



-- 

Shlomi Fish   https://www.shlomifish.org/
List of Portability Libraries - https://shlom.in/port-libs

Chuck Norris can become root on OpenBSD. By using nothing but /bin/echo.
(By: ZadYree and Shlomi Fish)
— https://www.shlomifish.org/humour/bits/facts/Chuck-Norris/

Please reply to list if it's a mailing list post - https://shlom.in/reply .


Re: How to read a particular environmental variable?

2020-04-08 Thread Simon Proctor
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: sleep 3600 vs task scheduler

2020-04-08 Thread ToddAndMargo via perl6-users

On 2020-04-07 20:44, ToddAndMargo via perl6-users wrote:

On 2020-04-07 20:39, Paul Procacci wrote:

What happens when you try it?
What impact do you observe?

My guess is the impact is exactly the time it takes for your cpu to 
perform the initial context switch for the syscall, and then another 
when waking up.


Hi Paul,

I opened the resource monitor and watched the CPU load:

raku -e "say 'start sleep 10'; sleep 10; say 'stop sleep;'"
start sleep 10
stop sleep;

Nothing.  Sleep must be recovering using a system interrupt.
Yippee!

-T



This is what I was afraid of.  The old fashioned batch
programming wait 10 seconds:

>ping -n 10 -i 10 8.8.8.8