does `copy` have a recursive option?

2017-03-27 Thread ToddAndMargo

Hi All,

Looking at

https://docs.perl6.org/routine/copy

It does not look like there is a `recursive` option.
It that correct?  Any work arounds?

If not, I have already written a recursive delete
on an FTP server that could be easily adapted to
"copy".  (The sub does a directory loop, if it
finds a directory, it calls itself with that
directory.  It digs it way down and backs off
when finished.  It was a fun write.)

Many thanks,
-T

--
~~~
Having been erased,
The document you're seeking
Must now be retyped.
~~~


Re: What module do I use to create a "windows"?

2017-03-27 Thread ToddAndMargo

On 03/27/2017 12:40 PM, Timo Paulssen wrote:



On 03/27/2017 09:25 PM, ToddAndMargo wrote:

Hi Timo,

Thank you!

Just out of curiosity -- I don't need it now -- is
there a similar module for Windows?

-T


GTK::Simple is already portable across linux, mac os, and windows.

Here's someone who patched zenity so it compiles to windows:
https://github.com/kvaps/zenity-windows

That zenity-windows repo has a windows installer in its releases
(there's a link to it from inside the readme)

HTH
  - Timo



Hi Timo,

Thank you!

Cool on Zenity.  I use it a lot in Linux from bash scripts,
but it is annoyingly limiting at times.  It is about time
I learned to do it directly.

-T

--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~


Re: tip on using /etc/crontab

2017-03-27 Thread ToddAndMargo

On 03/24/2017 06:56 PM, ToddAndMargo wrote:

Hi All,

Fedora Core 25 (Linux)

I just found out the hard way that if us use

 use Inline::Perl5;
 use Email::Simple:from;

your program will run from the command line, but when run
from /etc/crontab, your program will just disappear.

Mind you I actually did not use this code, I just
had forgotten to remove it.

It was a hair puller to find.

-T





These issue added concerning this:

RFE: attachments, comment #4
https://github.com/retupmoca/P6-Net-SMTP/issues/14

Won't run from cron
https://github.com/niner/Inline-Perl5/issues/93


--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~


Re: gtk::simple progress bar?

2017-03-27 Thread ToddAndMargo

On 03/27/2017 12:46 PM, Timo Paulssen wrote:

On 03/27/2017 09:40 PM, ToddAndMargo wrote:

Hi All,

Can GTK::Simple do a progress bar?

Not seeing an example here:
https://github.com/perl6/gtk-simple/tree/master/examples

-T



It's not documented, but it's implemented:

https://github.com/perl6/gtk-simple/blob/master/lib/GTK/Simple/ProgressBar.pm6

feel free to open a ticket that it should at least be put into the
readme, or maybe have an example created for it.




RFE: Please add Progress Bar to the list of examples
https://github.com/perl6/gtk-simple/issues/77



--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~


Re: gtk::simple progress bar?

2017-03-27 Thread Timo Paulssen
On 03/27/2017 09:40 PM, ToddAndMargo wrote:
> Hi All,
>
> Can GTK::Simple do a progress bar?
>
> Not seeing an example here:
> https://github.com/perl6/gtk-simple/tree/master/examples
>
> -T
>

It's not documented, but it's implemented:

https://github.com/perl6/gtk-simple/blob/master/lib/GTK/Simple/ProgressBar.pm6

feel free to open a ticket that it should at least be put into the
readme, or maybe have an example created for it.


gtk::simple progress bar?

2017-03-27 Thread ToddAndMargo

Hi All,

Can GTK::Simple do a progress bar?

Not seeing an example here:
https://github.com/perl6/gtk-simple/tree/master/examples

-T

--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~


trivia question on zef

2017-03-27 Thread ToddAndMargo

Hi All,

I do prefer Zef over Panda.

Trivia question; the stuff I see happening at the
beginning of a zef install, what is that?  Perhaps
a "C" compiler?

-T


--
~
I am Windows
I am the Blue Screen of Death
No one hears your screams
~


Re: What module do I use to create a "windows"?

2017-03-27 Thread ToddAndMargo

On 27/03/17 20:52, ToddAndMargo wrote:

Hi All,

RHEL 7.2 and Fedora 25.

I would like to create a window that presents the user
with a dynamically generated list for him to choose from,
along with a "next" and a "cancel" button.

What module do I use to create this?


Many thanks,
-T




On 03/27/2017 11:53 AM, Timo Paulssen wrote:
> Do it with GTK::Simple, or shell out to zenity
>
>

Hi Timo,

Thank you!

Just out of curiosity -- I don't need it now -- is
there a similar module for Windows?

-T

--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~


Re: What module do I use to create a "windows"?

2017-03-27 Thread Timo Paulssen
Do it with GTK::Simple, or shell out to zenity


On 27/03/17 20:52, ToddAndMargo wrote:
> Hi All,
>
> RHEL 7.2 and Fedora 25.
>
> I would like to create a window that presents the user
> with a dynamically generated list for him to choose from,
> along with a "next" and a "cancel" button.
>
> What module do I use to create this?
>
>
> Many thanks,
> -T
>


What module do I use to create a "windows"?

2017-03-27 Thread ToddAndMargo

Hi All,

RHEL 7.2 and Fedora 25.

I would like to create a window that presents the user
with a dynamically generated list for him to choose from,
along with a "next" and a "cancel" button.

What module do I use to create this?


Many thanks,
-T

--

Yesterday it worked.
Today it is not working.
Windows is like that.



Re: regex and performance question

2017-03-27 Thread ToddAndMargo

On 03/27/2017 10:43 AM, Brandon Allbery wrote:


On Mon, Mar 27, 2017 at 1:10 PM, ToddAndMargo > wrote:

Am I reintroducing a "regex"


It's a junction, not a regex. But junctions are even slower than
regexes: they are, in effect, trying to emulate a quantum computer. I
suspect it's doubly slow because not only are junctions themselves not
optimized, but it also breaks use of all other optimizations (figuring
out how to optimize them will be "fun").


Thank you!


Re: regex and performance question

2017-03-27 Thread Brandon Allbery
On Mon, Mar 27, 2017 at 1:10 PM, ToddAndMargo  wrote:

> Am I reintroducing a "regex"


It's a junction, not a regex. But junctions are even slower than regexes:
they are, in effect, trying to emulate a quantum computer. I suspect it's
doubly slow because not only are junctions themselves not optimized, but it
also breaks use of all other optimizations (figuring out how to optimize
them will be "fun").

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: "not" question

2017-03-27 Thread ToddAndMargo

On 03/27/2017 10:36 AM, Timo Paulssen wrote:

On 27/03/17 19:26, ToddAndMargo wrote:

and `none("789")` is the opposite of `contains`?


Nah, the fact that anything in the junction means "contains" is just
because you're feeding the junction through the contains method.

Junction evaluation happens with something we call "autothreading" (even
though no actual multithreading happens). When a function or method gets
called with a junction, the call will be split up to each of the parts
of the junction, and the result values are used to construct a new junction.

Here's an example:

uc("Hello" | "Goodbye" | "what") → uc("Hello") | uc("Goodbye") | uc("what")

junctions are most useful when you have something on the outside that
handles Bool values, because then the difference between "all", "any",
"one", and "none" actually do something:

("hello" | "goodbye" | "what").chars == 4 → ("hello".chars |
"goodbye".chars | "what".chars) == 4 → (5 | 7 | 4) == 4 → (False | False
| True) → True (because any of the three bools was True)

So with your all + none here's how it goes:

$x.contains($y & "abc" & none("789)) → $x.contains($y) &
$x.contains("abc") & none($x.contains("789"))

now here's the interesting part. $x.contains("789") evaluates to False,
and none(False) is True (none of the entries are True, giving True as
the result).

Now you have True & True & none(False) → True & True & True → True

HTH
  - Timo




Thank you!

So `none` is being used as `not`


--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~


Re: "not" question

2017-03-27 Thread Timo Paulssen
On 27/03/17 19:26, ToddAndMargo wrote:
> and `none("789")` is the opposite of `contains`?

Nah, the fact that anything in the junction means "contains" is just
because you're feeding the junction through the contains method.

Junction evaluation happens with something we call "autothreading" (even
though no actual multithreading happens). When a function or method gets
called with a junction, the call will be split up to each of the parts
of the junction, and the result values are used to construct a new junction.

Here's an example:

uc("Hello" | "Goodbye" | "what") → uc("Hello") | uc("Goodbye") | uc("what")

junctions are most useful when you have something on the outside that
handles Bool values, because then the difference between "all", "any",
"one", and "none" actually do something:

("hello" | "goodbye" | "what").chars == 4 → ("hello".chars |
"goodbye".chars | "what".chars) == 4 → (5 | 7 | 4) == 4 → (False | False
| True) → True (because any of the three bools was True)

So with your all + none here's how it goes:

$x.contains($y & "abc" & none("789)) → $x.contains($y) &
$x.contains("abc") & none($x.contains("789"))

now here's the interesting part. $x.contains("789") evaluates to False,
and none(False) is True (none of the entries are True, giving True as
the result).

Now you have True & True & none(False) → True & True & True → True

HTH
  - Timo


Re: "not" question

2017-03-27 Thread ToddAndMargo

On 27/03/17 19:11, Timo Paulssen wrote:

!"789" is just False.


On 27/03/17 18:53, ToddAndMargo wrote:

Hi All,

What am I doing wrong in my "AND not 789"?

$ perl6 -e 'my $x="abc123def456";
my $y="123"; if $x.contains( $y & "abc" & ! "789" )
{say "Yes"} else {say "no"};'

no

-T



On 03/27/2017 10:21 AM, Timo Paulssen wrote:
> Oh, I should have pointed out how to do what you actually meant to do:
>
> perl6 -e 'my $x = "abc123def456";
> my $y = "123";
> if $x.contains($y & "abc" & none("789")) { say "Yes" }
> else { say "No" }'
> Yes
>
> This uses a "none" junction, which takes part in the whole junction
> evaluation process, as opposed to the prefix: which just negates a
> value straight-up and doesn't know it's being used inside a junction.
>
> HTH
>   - Timo
>
>


Thank you!

and `none("789")` is the opposite of `contains`?


--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~


Re: "not" question

2017-03-27 Thread Timo Paulssen
Oh, I should have pointed out how to do what you actually meant to do:

perl6 -e 'my $x = "abc123def456";
my $y = "123";
if $x.contains($y & "abc" & none("789")) { say "Yes" }
else { say "No" }'
Yes

This uses a "none" junction, which takes part in the whole junction
evaluation process, as opposed to the prefix: which just negates a
value straight-up and doesn't know it's being used inside a junction.

HTH
  - Timo


On 27/03/17 19:11, Timo Paulssen wrote:
> !"789" is just False.
>
>
> On 27/03/17 18:53, ToddAndMargo wrote:
>> Hi All,
>>
>> What am I doing wrong in my "AND not 789"?
>>
>> $ perl6 -e 'my $x="abc123def456";
>> my $y="123"; if $x.contains( $y & "abc" & ! "789" )
>> {say "Yes"} else {say "no"};'
>>
>> no
>>
>> -T
>>


Re: regex and performance question

2017-03-27 Thread Timo Paulssen
Yeah, junctions are super useful, but not very fast.

compare these two pieces of code:

so "hello how are you today?".contains("hello" & "u t") for ^1_000_000

and

my $target = "hello how are you today?"; so
$target.contains("hello") && $target.contains("u t") for ^1_000_000


On my machine i get 25.7s for the first one and 1.5s for the second one.

On 27/03/17 19:10, ToddAndMargo wrote:
> Hi All,
>
> When I do a
>
>  if $x.contains( $y & "abc" )
>
> Am I reintroducing a "regex" and losing the performance
> gained by avoiding a regex?   Doesn't look like
> it to me, but I thought I'd better double check.
>
> Many thanks,
> -T
>


Re: "not" question

2017-03-27 Thread Timo Paulssen
!"789" is just False.


On 27/03/17 18:53, ToddAndMargo wrote:
> Hi All,
>
> What am I doing wrong in my "AND not 789"?
>
> $ perl6 -e 'my $x="abc123def456";
> my $y="123"; if $x.contains( $y & "abc" & ! "789" )
> {say "Yes"} else {say "no"};'
>
> no
>
> -T
>


Re: exit code: 141 causes Perl 6 to exit.

2017-03-27 Thread Rob Hoelz
FWIW, 141 is SIGPIPE. (signal 13 + WIFSIGNALED flag (128))

So something's happening in your RUN script that's causing it to write to a 
closed pipe.  I hope this helps!

-Rob

On Mon, 27 Mar 2017 11:51:03 +0300
Gabor Szabo  wrote:

> Putting
> 
> CATCH { default { put .^name, ': ', .Str } };
> 
> in the While loop helped with the restarting, but I am still not sure
> if this is the expected behavior or not.
> 
> 
> run.pl:
> 
> while True {
>  say "Starting";
>  shell("perl6 a.pl");
>CATCH { default { put .^name, ': ', .Str } };
> }
> 
> 
> a.pl:
> 
> print "in a.pl\n";
> exit(141);
> 


Re: exit code: 141 causes Perl 6 to exit.

2017-03-27 Thread Gabor Szabo
Putting

CATCH { default { put .^name, ': ', .Str } };

in the While loop helped with the restarting, but I am still not sure if this
is the expected behavior or not.


run.pl:

while True {
 say "Starting";
 shell("perl6 a.pl");
   CATCH { default { put .^name, ': ', .Str } };
}


a.pl:

print "in a.pl\n";
exit(141);


exit code: 141 causes Perl 6 to exit.

2017-03-27 Thread Gabor Szabo
The lack of open filehandles seem to be fixed. The server now stays up
for quite long time, but I've just seen the following on the command
line:


The spawned command './RUN' exited unsuccessfully (exit code: 141)
  in block  at wrap.pl6 line 5


I'd like to understand what this exit code: 141 might be, but also I
am surprised
this stopped the server.

After all I use this code to launch it:

https://github.com/szabgab/Perl6-Maven/blob/main/wrap.pl6

and run "perl6 wrap.pl6"

This should relaunch the server when it crashes, but it did not do it.
The wrapper itself excited.

Any idea what could be the source of exit code 141?
How to run the external script so even if it exits my main code does not exit.

(BTW using "run" instead of "shell" did not help either.)


Gabor
ps. The following two scripts can reproduce the issue with "shell":

run.pl:

while True {
say "Starting";
shell("perl6 a.pl");
say "Ending";
}


a.pl:

print "in a.pl\n";
exit(141);


$ perl6 run.pl
Starting
The spawned command 'perl6 a.pl' exited unsuccessfully (exit code: -1)
  in block  at run.pl line 3

$