Re: How to read a particular environmental variable?

2020-04-07 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-us...@perl.org> wrote: > On 2020-04-07 18:25, Brad Gilbert wrote: > > Of course %*ENV is case

Re: sleep 3600 vs task scheduler

2020-04-07 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

Re: sleep 3600 vs task scheduler

2020-04-07 Thread ToddAndMargo via perl6-users
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

Re: sleep 3600 vs task scheduler

2020-04-07 Thread Paul Procacci
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. On Tue, Apr 7, 2020 at 10:28 PM ToddAndMargo via perl6-users < perl6-us...@perl.org> w

Re: sleep 3600 vs task scheduler

2020-04-07 Thread ToddAndMargo via perl6-users
On Tue, Apr 7, 2020 at 6:02 AM ToddAndMargo via perl6-users mailto:perl6-us...@perl.org>> wrote: Hi All, Windows 7/10 Another piece of the puzzle. I want to loop Raku program once an hour. Is it better use `sleep 3600` or let the program die and restart every hour fro

Re: How to read a particular environmental variable?

2020-04-07 Thread ToddAndMargo via perl6-users
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 environmenta

Re: sleep 3600 vs task scheduler

2020-04-07 Thread Brad Gilbert
Run code once an hour: react whenever Supply.interval(60 * 60) { say "it's been an hour" } Right now that gets about 0.01 seconds slower every time the interval runs. (At least on my computer.) So it will get 1 second later every 4 days. Or if you want more precise control, you

Re: Dropbox and IO?

2020-04-07 Thread ToddAndMargo via perl6-users
On 2020-04-07 09:29, 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. Confirmed! Thank you all for the tips!

Re: How to read a web page?

2020-04-07 Thread ToddAndMargo via perl6-users
> On Tue, Apr 7, 2020 at 1:58 PM ToddAndMargo via perl6-users > mailto:perl6-us...@perl.org>> wrote: > > On 2020-04-07 02:55, Veesh Goldman wrote: > > Your question is way to vague. What do you actually want to do? > If you > > just wanna download a page, use curl or some other t

Re: How to read a particular environmental variable?

2020-04-07 Thread Brad Gilbert
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-us...@perl.org> wrote: > >> On Tue, Ap

Re: How to read a particular environmental variable?

2020-04-07 Thread ToddAndMargo via perl6-users
On Tue, Apr 7, 2020 at 6:48 PM ToddAndMargo via perl6-users mailto:perl6-us...@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? Man

Re: Can a sub be released?

2020-04-07 Thread Brad Gilbert
You do NOT want to use `fork`. MoarVM has several threads that are running, and `fork` doesn't handle that. A simple way is to just use the `start` statement prefix sub child-process () { sleep 2; say 'child says hi' } say 'starting child'; start child-process();

Re: How to read a particular environmental variable?

2020-04-07 Thread Gerard ONeill
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-us...@perl.org> wrote: > Hi All, > > $ raku -e 'say %*ENV;' > > Gives me ALL of them. Is there a way to just ask for > a particu

Re: Can a sub be released?

2020-04-07 Thread ToddAndMargo via perl6-users
On Tue, Apr 7, 2020 at 7:21 AM ToddAndMargo via perl6-users mailto:perl6-us...@perl.org>> wrote: Hi All, Can a subroutine be released from the main program to go off on its own? (Is this called "forked"?) If not how do I do a `qqx` or a `run` that releases the program to g

How to read a particular environmental variable?

2020-04-07 Thread ToddAndMargo via perl6-users
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

Re: Can a sub be released?

2020-04-07 Thread yary
They way I remember it (taught to me waaay back when) is that, you fork twice, and the grandchild process that lives on becomes a daemon whose parent is the system "init" process, PID 1, after the parent and 1st-generation child process exit. Found general concept at http://www.farhadsaberi.com/per

Re: Can a sub be released?

2020-04-07 Thread Paul Procacci
https://docs.perl6.org/language/5to6-perlfunc#fork https://docs.perl6.org/type/Thread I haven't tried myself but it's conceivable that you can start a new thread that exec's some external program. On Tue, Apr 7, 2020 at 7:21 AM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > Hi All

Re: unflattering flat

2020-04-07 Thread yary
I left out first line in the example REPL > my %hash-with-arrays = a => [1,2], b => [3,4], c=>5, d=>[6,[7,8]] {a => [1 2], b => [3 4], c => 5, d => [6 [7 8]]} > say gather %hash-with-arrays.values.deepmap: { .take } (6 7 8 1 2 3 4 5) > say %hash-with-arrays.values>>[].flat (6 [7 8] 1 2 3 4 5)

Re: unflattering flat

2020-04-07 Thread yary
Larry all looks good with the latest email and encoding! Interpreting %hash-with-arrays.values>>[].flat aka %hash-with-arrays.values»[].flat >> is hyperoperator https://docs.raku.org/language/operators#index-entry-hyper_ <<-hyper_>>-hyper_«-hyper_»-Hyper_operators and as for [] "it's the postcir

Re: unflattering flat

2020-04-07 Thread Larry Wall
On Tue, Apr 07, 2020 at 09:15:06AM -0700, Larry Wall wrote: : Maybe if I actually put a Chinese character in like 楽 it will leave it in UTF-8? Oops, actually, now that I think about it, 楽 (raku) is a Japanese-only character. The Chinese equivalents are traditional 樂 and simplified 乐. I really d

Re: Dropbox and IO?

2020-04-07 Thread Stephen Wilcoxon
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. On Tue, Apr 7, 2020 at 2:40 AM Simon Proctor wrote: > Ok I don't have access to my wind

Re: unflattering flat

2020-04-07 Thread Larry Wall
On Mon, Apr 06, 2020 at 08:04:45PM -0400, yary wrote: : Larry's answer came through my browser with munged Unicode, it looks like : this : : [image: image.png] : - with the Chinese character for "garlic" after the word "values" I wrote the Unicode equivalent of: %hash-with-arrays.values>>[].

Re: How to read a web page?

2020-04-07 Thread Veesh Goldman
Are you familiar with dynamic dns providers like duckdns.org (there are others, too). That coupled with a script that updates your ip with the provider, like ddclient (written in perl!), should be a more straightforward way of accomplishing what you want. Also, thank you for clarifying what you are

Can a sub be released?

2020-04-07 Thread ToddAndMargo via perl6-users
Hi All, Can a subroutine be released from the main program to go off on its own? (Is this called "forked"?) If not how do I do a `qqx` or a `run` that releases the program to go off on its own? Many thanks, -T

sleep 3600 vs task scheduler

2020-04-07 Thread ToddAndMargo via perl6-users
Hi All, Windows 7/10 Another piece of the puzzle. I want to loop Raku program once an hour. Is it better use `sleep 3600` or let the program die and restart every hour from the Task Scheduler. By better, I mean less of a CPU footprint. `sleep` would allow the user to cancel the program and no

Re: How to read a web page?

2020-04-07 Thread ToddAndMargo via perl6-users
On 2020-04-07 02:55, Veesh Goldman wrote: Your question is way to vague. What do you actually want to do? If you just wanna download a page, use curl or some other tool, no reason to do it from raku if there's nothing more than that. If you want more than that, then please be more specific. H

Re: How to read a web page?

2020-04-07 Thread ToddAndMargo via perl6-users
On 2020-04-07 02:38, Shlomi Fish wrote: Hi Todd! On Tue, 7 Apr 2020 02:15:13 -0700 ToddAndMargo via perl6-users wrote: How do I read (download) a web page? get? See https://github.com/raku-community-modules/raku-lwp-simple and https://github.com/shlomif/Freenode-programming-channel-FAQ/blo

Re: How to read a web page?

2020-04-07 Thread Shlomi Fish
Hi Todd! On Tue, 7 Apr 2020 02:15:13 -0700 ToddAndMargo via perl6-users wrote: > How do I read (download) a web page? get? See https://github.com/raku-community-modules/raku-lwp-simple and https://github.com/shlomif/Freenode-programming-channel-FAQ/blob/master/FAQ_with_ToC__generated.md#how-ca

Re: How to read a web page?

2020-04-07 Thread ToddAndMargo via perl6-users
> On Tue, Apr 7, 2020 at 12:15 PM ToddAndMargo via perl6-users > mailto:perl6-us...@perl.org>> wrote: > > How do I read (download) a web page? get? On 2020-04-07 02:55, Veesh Goldman wrote: Your question is way to vague. What do you actually want to do? If you just wanna download a page, us

Re: How to read a web page?

2020-04-07 Thread ToddAndMargo via perl6-users
On 2020-04-07 02:15, ToddAndMargo via perl6-users wrote: How do I read (download) a web page?  get? Came up with this: # zef --force-test install HTTP::Client $ raku -e 'use HTTP::Client; my $client=HTTP::Client.new; my $response = $client.get("http://checkip.dyndns.org/";); say $respon

Re: How to read a web page?

2020-04-07 Thread Veesh Goldman
Your question is way to vague. What do you actually want to do? If you just wanna download a page, use curl or some other tool, no reason to do it from raku if there's nothing more than that. If you want more than that, then please be more specific. On Tue, Apr 7, 2020 at 12:15 PM ToddAndMargo via

How to read a web page?

2020-04-07 Thread ToddAndMargo via perl6-users
How do I read (download) a web page? get?

Re: Dropbox and IO?

2020-04-07 Thread Simon Proctor
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

Re: Dropbox and IO?

2020-04-07 Thread Shlomi Fish
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