Re: Running external CLI tool and capturing output

2017-08-10 Thread Gabor Szabo
Oh right. Thanks. I forgot about them. Maybe
https://docs.perl6.org/routine/run should mention them as well.

In any case a simpler way to capture everything might be useful.

Gabor

On Thu, Aug 10, 2017 at 6:09 PM, Brock Wilcox
<awwa...@thelackthereof.org> wrote:
> How about qx and qxx? I guess those don't separate/capture stderr, and don't
> separate out the params.
>
> --Brock
>
>
> On Thu, Aug 10, 2017 at 10:57 AM, Gabor Szabo <szab...@gmail.com> wrote:
>>
>> The documentation has a nice example showing how to run an external
>> program and how to get its output or even its standard error.
>> https://docs.perl6.org/type/Proc
>>
>> However it looks a lot more complex than the plain backtick Perl 5 has
>> and more complex than the capture function of Capture::Tiny.
>> IMHO it is way too much code.
>>
>> I wrote a simple function wrapping it:
>>
>> sub capture(*@args) {
>> my $p = run @args, :out, :err;
>> my $output = $p.out.slurp: :close;
>> my $error  = $p.err.slurp: :close;
>> my $exit   = $p.exitcode;
>>
>> return {
>> out  => $output,
>> err  => $error,
>> exit => $exit;
>> };
>> }
>>
>> It can be used as:
>>
>> my $res = capture($*EXECUTABLE, 'bin/create_db.pl6');
>> say $res;
>>
>> or even
>>
>> say capture($*EXECUTABLE, 'bin/create_db.pl6');
>>
>> I wonder if I have just invented something that already exist in
>> Rakudo or if it is not there, then wouldn't it be a good idea to add
>> such a simple way to run external commands?
>>
>> regards
>>Gabor
>> ps. Backtick actually expected a single string and not a list of
>> parameters and supporting that mode, even if it is less secure, might
>> be also a good idea.


Running external CLI tool and capturing output

2017-08-10 Thread Gabor Szabo
The documentation has a nice example showing how to run an external
program and how to get its output or even its standard error.
https://docs.perl6.org/type/Proc

However it looks a lot more complex than the plain backtick Perl 5 has
and more complex than the capture function of Capture::Tiny.
IMHO it is way too much code.

I wrote a simple function wrapping it:

sub capture(*@args) {
my $p = run @args, :out, :err;
my $output = $p.out.slurp: :close;
my $error  = $p.err.slurp: :close;
my $exit   = $p.exitcode;

return {
out  => $output,
err  => $error,
exit => $exit;
};
}

It can be used as:

my $res = capture($*EXECUTABLE, 'bin/create_db.pl6');
say $res;

or even

say capture($*EXECUTABLE, 'bin/create_db.pl6');

I wonder if I have just invented something that already exist in
Rakudo or if it is not there, then wouldn't it be a good idea to add
such a simple way to run external commands?

regards
   Gabor
ps. Backtick actually expected a single string and not a list of
parameters and supporting that mode, even if it is less secure, might
be also a good idea.


Memory leak or just normal usage in Rakudo?

2017-08-03 Thread Gabor Szabo
Hi,

I think I've mentioned earlier that we see some memory leaks in Bailador.
I've started to investigate it by creating a small function that would
use "ps" to get the memory usage of the current process.

The first step was to do some sanity check and so I wrote a test script:

https://github.com/szabgab/p6-memory/blob/master/t/memory-usage.t

As I am far from being an expert in the field, I wonder if checking
the VSZ as reported by ps is even a good indication of the memory
consumption of a process?

Then I've to note that the results were different in almost every run
which makes me further wonder why?

The numbers are also drastically different between my OSX and running
on Travis-CI, though Rakudo is also different.

Does any of this make sense? Does it indicate any memory leak in
Rakudo already or is this just normal memory usage?

How could I improve my measuring and what else should I measure?

regards
Gabor


Re: Need sub for `LWP::UserAgent`

2017-07-28 Thread Gabor Szabo
On Fri, Jul 28, 2017 at 9:49 AM, ToddAndMargo <toddandma...@zoho.com> wrote:
>>> Hi All,
>>>
>>> I am trying to convert a p5 program to p6.  What do I use in
>>> place of `LWP::UserAgent`?
>>>
>>> I use it for downloading files from the web.  I need to be able
>>> to pass the following to the web page:
>>>
>>> Caller
>>> Host
>>> UserAgent
>>> Referer
>>> Cookies
>>>
>>> This is the p5 code I want to convert:
>>>
>>>http://vpaste.net/gtJgj
>>>
>>> Any words of wisdom?
>>>
>>> Many thanks,
>>> -T
>
> On 07/27/2017 10:30 PM, Gabor Szabo wrote:
>>
>> LWP::Simple now allows you to set the header of your request.
>> See my recent article with examples:
>> http://perl6maven.com/simple-web-client
>> I hope this helps.
>>
>> regards
>> Gabor
>>
>> On Fri, Jul 28, 2017 at 7:42 AM, Todd Chester <toddandma...@zoho.com>
>> wrote:
>
>
>
> I see your article.  I do believe this is what I want.
> 
> {
>   "args": {
> "language": "Perl",
> "math": "19+23=42",
> "name": "Larry Wall"
>   },
>   "headers": {
> "Connection": "close",
> "Host": "httpbin.org",
> "User-Agent": "LWP::Simple/0.090 Perl6/rakudo"
>   },
>   "origin": "17.19.208.37",
>   "url": "http://httpbin.org/get?name=Larry
> Wall=Perl=19%2B23%3D42"
> }
> 
>
> Questions:
>
> 1) may I leave off the `args` and only include the `headers`?
>
> 2) I need an example with headers.  I have no clue what goes
>before the first "{"
>
> Many thanks,
> -T

I think you quoted the response here and not the request.
What you need I think is the last example on that page.
Something like this:

my $html = LWP::Simple.new.get("http://httpbin.org/headers;, {
"User-Agent" => "Perl 6 Maven articles",
"Zone" => "q" }
);


Gabor


Re: Need sub for `LWP::UserAgent`

2017-07-27 Thread Gabor Szabo
LWP::Simple now allows you to set the header of your request.
See my recent article with examples: http://perl6maven.com/simple-web-client
I hope this helps.

regards
   Gabor

On Fri, Jul 28, 2017 at 7:42 AM, Todd Chester  wrote:
> Hi All,
>
> I am trying to convert a p5 program to p6.  What do I use in
> place of `LWP::UserAgent`?
>
> I use it for downloading files from the web.  I need to be able
> to pass the following to the web page:
>
>Caller
>Host
>UserAgent
>Referer
>Cookies
>
> This is the p5 code I want to convert:
>
>   http://vpaste.net/gtJgj
>
> Any words of wisdom?
>
> Many thanks,
> -T


Re: set (+) set = bag ?

2017-07-21 Thread Gabor Szabo
On Fri, Jul 21, 2017 at 2:07 PM, Timo Paulssen  wrote:
> You want (|) to get the union of two sets as a set.
>
> https://docs.perl6.org/language/setbagmix#Set%2FBag_Operators
>
> hth
>   - Timo

Oh thanks. Now I see there is also a link just under the "Operators"
section of the Set article.
I might not pay enough attention to details, I was looking for the
word  "union" in the article about Sets and haven't even noticed that
link.

I was already adding some more operators to that table when I got your reply.
Now I am not sure if that's needed or how to avoid unnecessary
frustration and questions by others.

Gabor


set (+) set = bag ?

2017-07-21 Thread Gabor Szabo
Looking at Sets https://docs.perl6.org/type/Set

I was happy to see (-) to work as I expected, but I was surprised to see
that (+) created a bag. Is that intentional? How can I get back the
set. Is the only way using the unicode character ∪ ?

(This is Rakudo version 2017.04.3 so I might be behind the times on this.)


$ perl6
To exit type 'exit' or '^D'
> my $a = set('a','b')
set(b, a)
> my $b = set('a', 'c')
set(a, c)

> $a
set(b, a)
> $b
set(a, c)

> $a (-) $b
set(b)
> $b (-) $a
set(c)


> $a (+) $b
bag(b, a(2), c)

> $a ∪ $b
set(b, a, c)

Gabor


Re: Memory usage

2017-07-20 Thread Gabor Szabo
On Thu, Jul 20, 2017 at 12:37 PM, Timo Paulssen <t...@wakelift.de> wrote:
> On 19/07/17 21:52, Gabor Szabo wrote:
>> Hi,
>>
>> is it possible to get the size of memory used by the current Perl 6
>> process? (From inside the code)
>> Is it possible to get the size of the individual variables?
>>
>> Gabor
>
> I'm not aware of something cross-platform that rakudo offers for memory
> use of a process, and getting the size of individual variables is an
> extremely hairy topic.
>
> You can use the --profile=heap target to get full snapshots of all
> objects in memory whenever GC kicks in, and go through it with the
> moar-heapanalyzer tool jnthn made.
>
> I had a pull-request open for an op i called "vmhealth" that would
> output a bunch of statistics including what the different allocators are
> doing, but progress halted when I didn't get input or came up with good
> ideas for what else to include. Here's the PR:
> https://github.com/MoarVM/MoarVM/pull/536
>
> The reason why "memory in use" is difficult is because of many things
> not having a single owner. Imagine an array, where you could have bound
> the individual containers to any amount of lexical variables, for example.
>
> Also, if there's exactly one Rat in the whole program, do you count the
> presence of the class itself as being used by the variable that holds
> that Rat?
>
> hope that sheds some light
>   - Timo

Thanks for the explanation. I hope your PR will make progress.

BTW the reason I asked this is as I think there is a memory leak
somewhere in Bailador
and I was hoping to use this to track it down. Any Perl 6 or Rakudo
specific suggestions for that?

Gabor


Re: processing misunderstand or bug?

2017-07-15 Thread Gabor Szabo
Thank you!
This helped us solve a major headache we had with processes hanging
around after the tests have finished:

https://github.com/Bailador/Bailador/issues/194

regards
Gabor


Re: processing misunderstand or bug?

2017-07-15 Thread Gabor Szabo
Hi,

Brandon, thanks for the explanation.

If I understand correctly, then this means Ctrl-C sends a SIGINT to
both the main process I ran and the child process I created using
Proc::Async.  When I run kill -2 PID it only sends the SIGINT to the
process I mentioned with PID.
(Which in my case was the process I ran.)

Then here is the problem which is closer to our original problem. I
have another script that uses Proc::Async to launch the previous
process. So now I have a main process, that has a child process which
has a child process.

use v6;
my $proc = Proc::Async.new($*EXECUTABLE, "async.pl6");
$proc.stdout.tap: -> $s { print $s };
my $promise = $proc.start;
sleep 10;
$proc.kill;

The "kill" there kill the immediate child but leaves the grandchild running.

Is there a way to send a signal to all the processes created by that
Proc::Async.new and to their children as well?

What I came up now is that changed the previous script (called
async.pl6) and added a line:

signal(SIGINT).tap( { say "Thank you for your attention"; $proc.kill } );

as below:

use v6;
my $proc = Proc::Async.new($*EXECUTABLE, "-e", "sleep 2; say 'done'");
$proc.stdout.tap: -> $s { print $s };
my $promise = $proc.start;
signal(SIGINT).tap( { say "Thank you for your attention"; $proc.kill } );
await $promise;

Gabor


processing misunderstand or bug?

2017-07-15 Thread Gabor Szabo
Hi,

I don't understand this, and I wonder could shed some light on the situation?

I have the following experimental program:

use v6;
my $proc = Proc::Async.new($*EXECUTABLE, "-e", "sleep 2; say 'done'");
$proc.stdout.tap: -> $s { print $s };
my $promise = $proc.start;
await $promise;

If I run this in one terminal and run "ps axuw" in another terminal I
see 2 processes running.
If I press Ctrl-C in the terminal where I launched the program, both
processes are closed.

OTOH If I run "kill PID" with the process ID of the parent process
then only that process is killed. The child process is still waiting
for the prompt.

It does not make any difference if I use kill PID, or kill -2 PID or
kill -3 PID.

I'd understand that "kill PID" leaves the child process but then why
does Ctrl-C kill both? And then how comes "kill -2 PID", which as I
understand must be the same SIGINT as the Ctrl-C, only kills the
parent?


This is Rakudo version 2017.04.3 built on MoarVM version 2017.04-53-g66c6dda
running on OSX.

regards
Gabor


clone and deep copy of arrays

2017-07-11 Thread Gabor Szabo
Hi,

I wonder what does .clone do and how can I create a deep copy or deep
clone of an array?

Reading https://docs.perl6.org/type/Array#method_clone I don't
understand what does it do as the example there works without clone as
well:

suggest I'd need a

> my @a = (1, 2, 3)
[1 2 3]
> my @b = @a;
[1 2 3]
> @a[1] = 42
42
> @b.append(100)
[1 2 3 100]
> dd @a
Array @a = [1, 42, 3]
Nil
> dd @b
Array @b = [1, 2, 3, 100]
Nil


On the other hand if I have a deeper data structure, then even .clone
does not help.


> my @x = {a => 1}, {b => 2};
[{a => 1} {b => 2}]
> my @y = @x.clone
[{a => 1} {b => 2}]
> @x[0] = 42
42
> dd @x
Array @x = [{:a(42)}, {:b(2)}]
Nil
> dd @y
Array @y = [{:a(42)}, {:b(2)}]
Nil

So I wonder what does .clone do and how could I make a deep copy (deep
clone) of the whole data structure I have in @x.

regards
   Gabor


Re: accepting values on the command line

2017-07-01 Thread Gabor Szabo
On Sat, Jul 1, 2017 at 4:30 PM, Elizabeth Mattijsen <l...@dijkmat.nl> wrote:
>
>> On 1 Jul 2017, at 15:15, Gabor Szabo <szab...@gmail.com> wrote:
>>
>> I was hoping to wrote a simple script that would accept a bunch of
>> filenames on the command line so I wrote:
>>
>> #!/usr/bin/env perl6
>> use v6;
>>
>> multi sub MAIN(@files) {
>>say @files.perl;
>> }
>
> This signature will only accept an Iterable.  The command line parameters are 
> *not* considered a list, so this will not match.  What you need is a slurpy 
> array:
>
> multi sub MAIN(*@files) {
> say @files.perl;
> }
>
>
> $ 6 'sub MAIN(*@a) { dd @a }' a b c d
> ["a", "b", "c", "d"]
>

thanks
Gabor


accepting values on the command line

2017-07-01 Thread Gabor Szabo
I was hoping to wrote a simple script that would accept a bunch of
filenames on the command line so I wrote:


#!/usr/bin/env perl6
use v6;

multi sub MAIN(@files) {
say @files.perl;
}



$ perl6 code.pl6
Usage:
  code.pl6 

$ perl6 code.pl6 abc
Usage:
  code.pl6 

$ perl6 code.pl6 abc def
Usage:
  code.pl6 

I got desperate, but that did not help either:
$ perl6 code.pl6 --files abc
Usage:
  code.pl6 


I am rather confused by this.


$ perl6 -v
This is Rakudo version 2017.06 built on MoarVM version 2017.06
implementing Perl 6.c.


Gabor


Re: not enough memory

2017-06-29 Thread Gabor Szabo
On Thu, Jun 29, 2017 at 11:43 AM, Lloyd Fournier <lloyd.fo...@gmail.com> wrote:
> I'm not sure if it's related but I've been getting a few weird memory
> related issues with HEAD and zef. e.g my travis build just segfaulted:
>
> https://travis-ci.org/spitsh/spitsh/builds/248242106#L1355
>
> And a day or so ago I got:
>
> "MoarVM panic: Heap corruption detected: pointer 0x7f0fe9a16410 to past
> fromspace"
> https://travis-ci.org/spitsh/spitsh/builds/247357557#L1355
>
> Are you also using a recent rakudo?

Not really.

This is Rakudo version 2017.06 built on MoarVM version 2017.06
implementing Perl 6.c.


>
> LL
>
>
> On Thu, Jun 29, 2017 at 4:37 PM Gabor Szabo <szab...@gmail.com> wrote:
>>
>> hi,
>>
>> I've got this "not enough memory" twice today while trying to upgrade
>> some packages using zef.
>> Once when I ran 'zef upgrade zef' and then again when I ran
>> 'zef --debug upgrade Bailador'.
>>
>> In both cases the error was shown during the running of the tests.
>>
>> After running the first command again it worked.
>>
>> The second command kept the same error message.
>>
>> This machine had 1 Gb memory.
>>
>> After adding another Gb the second command worked as well.
>>
>> Gabor


not enough memory

2017-06-29 Thread Gabor Szabo
hi,

I've got this "not enough memory" twice today while trying to upgrade
some packages using zef.
Once when I ran 'zef upgrade zef' and then again when I ran
'zef --debug upgrade Bailador'.

In both cases the error was shown during the running of the tests.

After running the first command again it worked.

The second command kept the same error message.

This machine had 1 Gb memory.

After adding another Gb the second command worked as well.

Gabor


Re: The speed (improvement) of Rakudo

2017-06-17 Thread Gabor Szabo
The first one is the closest to what I was hoping to see. Very
impressive. Thanks.

Gabor


On Sat, Jun 17, 2017 at 9:10 AM, H.Merijn Brand <h.m.br...@xs4all.nl> wrote:
> On Sat, 17 Jun 2017 07:46:46 +0300, Gabor Szabo <szab...@gmail.com>
> wrote:
>
>> Hi,
>>
>> Is there some measurements regarding the speed of Rakudo?
>
> Mine are probably the longest record of speed measurements, but it is
> just measuring one task (that uses a lot of operations). It is not
> measuring all aspects of perl6
>
> http://tux.nl/Talks/CSV6/speed4.html
>
> And a comparison of that task to other languages
>
> http://tux.nl/Talks/CSV6/speed5.html
>
> And the explanation of what it shows
>
> https://github.com/Tux/CSV/blob/master/README.speed
>
> Is that what you were looking for?
>
>> e.g. It would be nice to have a graph of some hand-picked operations
>> measured at different points in time of the development of Rakudo and
>> then graphed in a nice way. Is there anything like that?
>>
>> Gabor
>
> --
> H.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/
> using perl5.00307 .. 5.27   porting perl5 on HP-UX, AIX, and openSUSE
> http://mirrors.develooper.com/hpux/http://www.test-smoke.org/
> http://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/


The speed (improvement) of Rakudo

2017-06-16 Thread Gabor Szabo
Hi,

Is there some measurements regarding the speed of Rakudo?

e.g. It would be nice to have a graph of some hand-picked operations
measured at different points in time of the development of Rakudo and
then graphed in a nice way. Is there anything like that?

Gabor


Re: next

2017-06-16 Thread Gabor Szabo
On Sat, Jun 17, 2017 at 4:19 AM, ToddAndMargo  wrote:
> On 06/16/2017 06:08 PM, Brandon Allbery wrote:
>>
>> On Fri, Jun 16, 2017 at 9:02 PM, ToddAndMargo > > wrote:
>>
>> I am afraid I am not understanding "next" again.
>>
>> When you invoke it, does it pop you back at the start of
>> the loop or just cough up the next value?
>>
>>
>> The former. Or you can think of it as jumping past everything else in the
>> loop body so the next thing it does is get the next value and run the loop
>> body with it.
>
>
> Hi Brandon,
>
> I kept thinking it was going to cough up the next value,
> not restart the loop.

I probably would not say "restart" the loop.
It goes to the *next* iteration of the loop:


If the loop has a condition it jumps to check that condition again and
acts accordingly.
(If the condition is true it does the next iteration, if the condition
is false it ends the loop.)

use v6;

my $i = 0;

while $i < 6 {
$i++;
next if $i %% 2;   # if it can be divided by two go to next iteration
say $i;
}

prints
1
3
5


If the loop has some action and a condition it will jump to  execute
the action again (increment $i) and check the condition and act
accordingly doing the next iteration or quitting the loop.

use v6;

loop (my $i = 0; $i < 10; $i++)  {
next if $i %% 2;# if it can be divided by two go to next iteration
say $i;
}

will print
1
3
5
7
9


Gabor


Re: getting help in the REPL

2017-06-14 Thread Gabor Szabo
Thanks for all the responses so far.

On Wed, Jun 14, 2017 at 4:44 PM, Timo Paulssen  wrote:
> WHY and WHEREFOR are "fully" supported, it's just that we've not put any
> pod into the core setting and we don't have helper code that loads it
> "lazily" when WHY is called the first time on a core class or sub …

$ perl6
To exit type 'exit' or '^D'
> my @x = 1, 2, 3;
[1 2 3]
> @x.WHY
(Any)
> @x.WHEREFOR
No such method 'WHEREFOR' for invocant of type 'Array'
  in block  at  line 1

$ perl6 -v
This is Rakudo version 2017.04.3 built on MoarVM version 2017.04-53-g66c6dda
implementing Perl 6.c.


In additionally, can I list all the built-in variables, functions, and
objects? While inside the REPL..


regards
  Gabor


getting help in the REPL

2017-06-14 Thread Gabor Szabo
Hi,

In the python interactive shell one can write dir(object)  and it
lists the attributes and methods of the object. One can write
help(object) and get the documentation of the object.

Is there anything similar in Perl 6?

Gabor


Re: Undeclared routine: break used at line ...

2017-06-13 Thread Gabor Szabo
On Tue, Jun 13, 2017 at 9:33 PM, Elizabeth Mattijsen <l...@dijkmat.nl> wrote:
>> On Tue, Jun 13, 2017 at 8:50 PM, Elizabeth Mattijsen <l...@dijkmat.nl> wrote:
>>>> On 13 Jun 2017, at 19:34, Gabor Szabo <szab...@gmail.com> wrote:
>>>>
>>>> I just managed to write
>>>>
>>>> while True {
>>>>   ...
>>>>   break if $code eq 'exit';
>>>>   ...
>>>> }
>>>>
>>>>
>>>> I wonder if Rakudo could be more cleaver in this particular case and
>>>> remind me to use 'last' instead of 'break'.
>>> Is the undeclared sub error not helpful enough?
>> I think for someone who comes from a language where 'break' is the
>> keyword, this would be very surprising
>> and an telling that person it is called 'last' in Perl 6 would be a nice 
>> touch.
>
> After https://github.com/rakudo/rakudo/commit/69b1b6c808 you get:
>
> $ 6 'break'
> ===SORRY!=== Error while compiling -e
> Undeclared routine:
> break used at line 1. Did you mean 'last’?
>
> $ 6 'sub brake() {}; break'
> ===SORRY!=== Error while compiling -e
> Undeclared routine:
> break used at line 1. Did you mean 'brake', 'last’?
>
>
> :-)
>
>
> Liz

Thank you :)

Gabor


Re: Undeclared routine: break used at line ...

2017-06-13 Thread Gabor Szabo
On Tue, Jun 13, 2017 at 8:50 PM, Elizabeth Mattijsen <l...@dijkmat.nl> wrote:
>
>> On 13 Jun 2017, at 19:34, Gabor Szabo <szab...@gmail.com> wrote:
>>
>> I just managed to write
>>
>> while True {
>>...
>>break if $code eq 'exit';
>>...
>> }
>>
>>
>> I wonder if Rakudo could be more cleaver in this particular case and
>> remind me to use 'last' instead of 'break'.
>
> Is the undeclared sub error not helpful enough?

I think for someone who comes from a language where 'break' is the
keyword, this would be very surprising
and an telling that person it is called 'last' in Perl 6 would be a nice touch.

>
> Alternately, you could do:
>
>   my  := 
>
> and have it just do the right thing  :-)
>
>
> Finally,
>
>   while True {
>
> is better written as:
>
>   loop {
>
> :-)
>
>
>
> Liz

Thanks
   Gabor


Undeclared routine: break used at line ...

2017-06-13 Thread Gabor Szabo
I just managed to write

while True {
...
break if $code eq 'exit';
...
}


I wonder if Rakudo could be more cleaver in this particular case and
remind me to use 'last' instead of 'break'.

Gabor


Re: How do you call the variable types?

2017-06-09 Thread Gabor Szabo
Brad, thanks for your reply.
I accept your point on not calling $-variables "generic variables",
but then how do you call them?

The same with the other 3. You described what they do in the same way
as the documentation does, but
when you casually speak about them, you know, with friends in bar :-),
 what do you call them then? e.g.:

@a = 23, 14, 49;

Do you say:
"I assign the list on the right hand side to a variable that does the
Positional role."?
or
"I assign the list on the right hand side to an array." ?
or
"I assign the list on the right hand side to an at-variable." ?
or
Something completely different.

Gabor



On Sat, Jun 10, 2017 at 7:21 AM, Brad Gilbert <b2gi...@gmail.com> wrote:
> @ does the Positional role
> % does Associative
> & does Callable
> $ causes its value to be an item (its values do not flatten into an
> outer list when you use `flat`)
>
> my %hash is SetHash;
>
> Array does Positional, and all of its values are itemized
>
> We are unlikely to call $ variables "generic" because the word
> "generic" is too generic.
> For example Java has generics, and they are not variables.
> Why muddy the waters by using a word that has many different meanings
> in different programming languages?
>
> On Fri, Jun 9, 2017 at 1:21 AM, Richard Hainsworth
> <rnhainswo...@gmail.com> wrote:
>> It also seems to me that 'scalar' gives the wrong impression compared to
>> arrays. A scalar in a vector is a component of a vector.
>>
>> I was thinking of "generic".
>>
>> Hence "$variable" is a generic variable because it can hold any type of
>> content.
>>
>>
>>
>> On Friday, June 09, 2017 02:10 PM, Gabor Szabo wrote:
>>>
>>> Looking at https://docs.perl6.org/language/variables there are 4
>>> variable types with sigil:  $, @, %, &.
>>> In Perl 5 I used to call them scalar, array, hash, and function
>>> respectively, even if the scalar variable had a reference to an array
>>> in it.
>>>
>>> How do you call them in Perl 6?
>>>
>>> As I understand @ always holds an array (@.^name is always Array or
>>> some Array[type]). Similarly % always holds a hash and & is always a
>>> function or a method.
>>> So calling them array, hash, and function sounds good.
>>>
>>> However I am not sure what to call the variables with a $ sigil?
>>> Should they be called "scalars"? Wouldn't that case confusion as there
>>> is also a container-type called Scalar.
>>>
>>> The word "scalar" appears twice in the document describing the
>>> variables: https://docs.perl6.org/language/variables and a total of
>>> 135 in the whole doc including the 5to6 documents and the document
>>> describing the Scalar type.
>>> The document describing the Scalar type:
>>> https://docs.perl6.org/type/Scalar the term "$-sigiled variable" is
>>> used which seems to be a bit long for general use.
>>>
>>> So I wonder how do *you* call them?
>>>
>>> Gabor


How do you call the variable types?

2017-06-09 Thread Gabor Szabo
Looking at https://docs.perl6.org/language/variables there are 4
variable types with sigil:  $, @, %, &.
In Perl 5 I used to call them scalar, array, hash, and function
respectively, even if the scalar variable had a reference to an array
in it.

How do you call them in Perl 6?

As I understand @ always holds an array (@.^name is always Array or
some Array[type]). Similarly % always holds a hash and & is always a
function or a method.
So calling them array, hash, and function sounds good.

However I am not sure what to call the variables with a $ sigil?
Should they be called "scalars"? Wouldn't that case confusion as there
is also a container-type called Scalar.

The word "scalar" appears twice in the document describing the
variables: https://docs.perl6.org/language/variables and a total of
135 in the whole doc including the 5to6 documents and the document
describing the Scalar type.
The document describing the Scalar type:
https://docs.perl6.org/type/Scalar the term "$-sigiled variable" is
used which seems to be a bit long for general use.

So I wonder how do *you* call them?

Gabor


How to install from a specific Git branch?

2017-06-07 Thread Gabor Szabo
Hi There!

In the Bailador project we use a branch called 'dev' for development
and one called 'main' for releases. Or at least we try to.

In the META.list of the ecosystem
https://github.com/perl6/ecosystem/blob/master/META.list we have
listed the 'main' branch:
https://raw.githubusercontent.com/Bailador/Bailador/main/META6.json

However it seems that zef still installs from the 'dev' branch which
is the "Default branch" on GitHub. At least when running on Travis-CI
(of another project that has Bailador as its dependency).  (It could
not install Bailador:
https://travis-ci.org/szabgab/6blog/builds/240466600 because some new
files were not added to the provides key of the META file. After
fixing it on the 'dev' branch:
https://travis-ci.org/szabgab/6blog/builds/240481882 )

Am I misunderstanding something here? Do I need to make some further
changes in the META file of Bailador
https://github.com/Bailador/Bailador or the other code that used
Bailador: https://github.com/szabgab/6blog in order to tell zef to
install from the 'main' branch? Is this a Travis related thing?


regards
Gabor
ps. The Bailador crowdfunding now has 99 supporters. It would be nice
to see you too!
https://www.indiegogo.com/projects/book-web-application-development-in-perl-6-website--2/reft/775728/p6user-0607


Re: Is there a linter for Perl 6? (like Perl::Critic or pylint)

2017-06-03 Thread Gabor Szabo
I think that runs perl6 -c, right?
Then no, I did not mean that.
I mean a tool for static analysis like Perl::Critic in Perl 5 that
would point out potential bugs,
or recommend better practices.

I've added a very naive implementation of checking for "use v6;"
https://github.com/Bailador/Bailador/blob/main/t/00-lint.t

regards
Gabor

On Thu, Jun 1, 2017 at 2:50 PM, Ahmad Zawawi <ahmad.zaw...@gmail.com> wrote:
> Hi Gabor,
>
> Like https://atom.io/packages/atom-perl6-editor-tools for instance or
> project-level linting?
>
> Regards,
> Ahmad
>
>
> On Thu, Jun 1, 2017 at 9:02 AM, Gabor Szabo <szab...@gmail.com> wrote:
>>
>> e.g. I'd like to check that every pl pm and t file in our project has a
>> "use v6;" at the beginning.
>>
>> regards
>>Gabor
>
>


Re: Creating an array of a single hash

2017-06-01 Thread Gabor Szabo
On Thu, Jun 1, 2017 at 5:44 PM, Timo Paulssen  wrote:
> Yeah, you can use the prefix $ to itemize things, like so:
>
> timo@schmand ~> perl6 -e 'my @y = ${ name => "Foo" }; say @y.gist;
> say @y.^name; say @y[0].^name'
> [{name => Foo}]
> Array
> Hash
>
> HTH
>   - Timo

Thanks.
Gabor


Creating an array of a single hash

2017-06-01 Thread Gabor Szabo
use v6;

my @x = { name => "Foo" }, { name => "Bar"}
say @x.gist; # [{name => Foo} {name => Bar}]
say @x.^name;# Array
say @x[0].^name; # Hash

my @y = { name => "Foo" }
say @y;   # [name => Foo]
say @y.^name; # Array
say @y[0].^name;  # Pair

my @z = { name => "Foo" },;
say @z;   # [{name => Foo}]
say @z.^name; # Array
say @z[0].^name;  #  Hash


In the first example, creating an array of 2 hashes work.
In the second example the listy assignment removes the hashy-ness of
the right hand side.
In the 3rd example adding a comma at the end solves the problem.

Is this how it is recommended to initiate an array with a single hash?
Is there an operator that forces the assignment to item-assignment?

Gabor


Is there a linter for Perl 6? (like Perl::Critic or pylint)

2017-06-01 Thread Gabor Szabo
e.g. I'd like to check that every pl pm and t file in our project has a
"use v6;" at the beginning.

regards
   Gabor


slightly unexpected JSON roundtrip for arrays

2017-05-31 Thread Gabor Szabo
When converting an array to json and then back again, I need to use |
or () in order to get back the original array in a @variable.

This surprised me, especially as for hashes the roundtrip worked
without any extra work.
I was wondering if this is really the expected behaviour?

Gabor

use v6;
use JSON::Fast;
#use JSON::Tiny;

my @elems1;
@elems1.push: {
name => 'Foo',
id   => 1,
};

say @elems1.gist; # [{id => 1, name => Foo}]

my $json_str = to-json @elems1;
#say $json_str;

my (@elems2) = from-json $json_str;
say @elems2.gist;# [{id => 1, name => Foo}]

my @elems3 = | from-json $json_str;
say @elems3.gist; # [{id => 1, name => Foo}]

my @elems4 = from-json $json_str;
say @elems4.gist;# [[{id => 1, name => Foo}]]


Re: run() not capturing exitcode properly?

2017-05-29 Thread Gabor Szabo
On Tue, May 30, 2017 at 7:21 AM, Gabor Szabo <szab...@gmail.com> wrote:
>> my $p = run "ls", "dadsad", :out, :err;
> Proc.new(in => IO::Pipe, out => IO::Pipe.new(:path(""),:chomp), err =>
> IO::Pipe.new(:path(""),:chomp), exitcode => 0, signal => 0, command =>
> ["ls", "dadsad", "adadsa"])
>>
>> $p.exitcode
> 0
>
>
> While for the same command in the shell   $? will hold 1 as the
> directory does not exist.
>
> Is this a bug or am I misunderstanding something?
>
> This is Rakudo version 2017.04.3 built on MoarVM version 2017.04-53-g66c6dda
> implementing Perl 6.c.
>
> Running on OSX.
>
> Gabor

On the other hand if I try to access the captured output or error, an
exception is raised:

> $p.out.slurp: :close;
The spawned command 'ls' exited unsuccessfully (exit code: 1)
  in block  at  line 1\


.add missing from IO::Path?

2017-05-28 Thread Gabor Szabo
Reading https://docs.perl6.org/type/IO::Path#method_child
I thought I need to use .child or .add but .add does not seem to work:

"foo/bar".IO.add("def")
No such method 'add' for invocant of type 'IO::Path'
  in block  at  line 1


Gabor


zef, zef-j, zef-m

2017-05-28 Thread Gabor Szabo
Hi,

I've just noticed that in /Applications/Rakudo/share/perl6/site/bin/ I
have 3 copies
of every script. One with a -j and one with a -m at the end just as for zef:

zef
zef-j
zef-m

The files seem to be identical.

Why are there 3 and what is their purpose?

Gabor


Re: Absolute path to directory of the current perl program

2017-05-28 Thread Gabor Szabo
Nice.

I think this would be a good addition to the docs :)

You can also write

   $*PROGRAM.parent.parent.parent.parent.absolute;

but if your relative path is too short, you might end up with a bunch
of .. like this:

/Users/gabor/work/perl6maven.com/../..

Gabor

On Sun, May 28, 2017 at 9:10 AM, Lloyd Fournier <lloyd.fo...@gmail.com> wrote:
> After thinking about what Zoffix said, probably what you're meant to do is:
>
> $*PROGRAM.parent.absolute
>
> Which leaves the stringification (.absolute) until last.
>
>
> On Sun, May 28, 2017 at 4:04 PM Lloyd Fournier <lloyd.fo...@gmail.com>
> wrote:
>>
>> FYI:
>>
>> 15:57 < llfourn> Zoffix: is there any plan to make .dirname and .absolute
>> on IO::Path return an IO::Path?
>> 15:58 < llfourn> (rather than a Str)
>> 15:58 < Zoffix> llfourn: no
>> 15:58 < Zoffix> .absolute is one of the two ways to stringify an IO::Path
>> (the second being .relative)
>> 15:58 < Zoffix> And .dirname is part of .parts; all Str objects as well
>>
>>
>> On Sun, May 28, 2017 at 3:54 PM Gabor Szabo <szab...@gmail.com> wrote:
>>>
>>> thanks.
>>>
>>> $*PROGRAM.dirname.IO.absolute;
>>>
>>> also works, but yours seem better.
>>>
>>> As a side note, dirname does not return and IO::Path object either.
>>>
>>> Gabor
>>>
>>>
>>> On Sat, May 27, 2017 at 6:48 PM, Lloyd Fournier <lloyd.fo...@gmail.com>
>>> wrote:
>>> > I'd use
>>> >
>>> > $*PROGRAM.absolute.IO.dirname
>>> >
>>> > I'm not sure why .absolute doesn't return an IO::Path object. Maybe
>>> > that's
>>> > being addressed as part of Zoffix++'s IO work.
>>> >
>>> >
>>> > On Sat, May 27, 2017 at 10:07 PM Gabor Szabo <szab...@gmail.com> wrote:
>>> >>
>>> >> I came up with this:
>>> >>
>>> >> say $*PROGRAM-NAME.IO.absolute.IO.dirname;
>>> >>
>>> >> but I wonder if there is a simpler way to do it?
>>> >>
>>> >> regards
>>> >> Gabor


Re: Absolute path to directory of the current perl program

2017-05-27 Thread Gabor Szabo
thanks.

$*PROGRAM.dirname.IO.absolute;

also works, but yours seem better.

As a side note, dirname does not return and IO::Path object either.

Gabor


On Sat, May 27, 2017 at 6:48 PM, Lloyd Fournier <lloyd.fo...@gmail.com> wrote:
> I'd use
>
> $*PROGRAM.absolute.IO.dirname
>
> I'm not sure why .absolute doesn't return an IO::Path object. Maybe that's
> being addressed as part of Zoffix++'s IO work.
>
>
> On Sat, May 27, 2017 at 10:07 PM Gabor Szabo <szab...@gmail.com> wrote:
>>
>> I came up with this:
>>
>> say $*PROGRAM-NAME.IO.absolute.IO.dirname;
>>
>> but I wonder if there is a simpler way to do it?
>>
>> regards
>> Gabor


Re: Get Better error message that "is trait on $-sigil variable not yet implemented. Sorry."?

2017-05-27 Thread Gabor Szabo
Excellent. Thanks.
 Gabor

On Fri, May 26, 2017 at 1:15 PM, Elizabeth Mattijsen <l...@dijkmat.nl> wrote:
> Fixed with https://github.com/rakudo/rakudo/commit/f2fca0c8c2 .
>
>> On 26 May 2017, at 10:47, Brent Laabs <bsla...@gmail.com> wrote:
>>
>> To file a bug in Rakudo, you should email rakudo...@perl.org.
>>
>> If it's a better error message you want, put "LTA Error" in the email 
>> subject somewhere.  LTA means "less than awesome", because we in Perl 6 land 
>> only accept awesome error messages.
>>
>> If you want to actually have the feature, put "[NYI]" in the subject line, 
>> for "not yet implemented".
>>
>> You can of course track Perl 6 bugs at in RT, perl6 queue: 
>> https://rt.perl.org/
>>
>> On Fri, May 26, 2017 at 1:34 AM, Gabor Szabo <szab...@gmail.com> wrote:
>> I just tried:
>>
>>
>> > my $x is Int = 42;
>> ===SORRY!=== Error while compiling:
>> is trait on $-sigil variable not yet implemented. Sorry.
>> --> my $x is Int⏏ = 42;
>> expecting any of:
>> constraint
>>
>> and was a bit disappointed. It took me a while and reading the book of
>> Andrew Shitov till I tried
>>
>> > my Int $x = 42;
>> 42
>>
>>
>> I wonder if the error message could hint at this way of declaring a
>> type constraint?
>>
>> Gabor
>>


How to upgrade a module?

2017-05-26 Thread Gabor Szabo
Hi there,

So I have been working on Bailador and pushing out changes lately.
How can I tell zef to upgrade it?

I ran

zef update
zef install --force Bailador

it installed Bailador again, but it was not the most recent code from GitHub.

I tried

zef upgrade Bailador

It told me

===> Searching for: Bailador
The following distributions are already at their latest versions: Bailador

I looked at https://modules.perl6.org/update.log and I don't see an error there.

I also search for Bailador.pm:

-rw-r--r--  1 gabor  staff  2282 Mar 25 11:46
/Users/gabor/.zef/store/Bailador.git
-rw-r--r--  1 gabor  staff  2282 Mar 25 11:46 /Users/gabor/.zef/tmp/Bailador.git
-rw-r--r--  1 gabor  staff  2788 May 26 08:33
/Users/gabor/work/Bailador/lib/Bailador.pm


What do I need to do to get zef see the most recent version in GitHub?

regards
   Gabor


Get Better error message that "is trait on $-sigil variable not yet implemented. Sorry."?

2017-05-26 Thread Gabor Szabo
I just tried:


> my $x is Int = 42;
===SORRY!=== Error while compiling:
is trait on $-sigil variable not yet implemented. Sorry.
--> my $x is Int⏏ = 42;
expecting any of:
constraint

and was a bit disappointed. It took me a while and reading the book of
Andrew Shitov till I tried

> my Int $x = 42;
42


I wonder if the error message could hint at this way of declaring a
type constraint?

Gabor


Re: Are sigils required?

2017-05-26 Thread Gabor Szabo
thanks!


Gabor "impatient" Szabo

On Fri, May 26, 2017 at 9:27 AM, Brent Laabs <bsla...@gmail.com> wrote:
> You didn't keep reading far enough.
>
>> For information on variables without sigils, see sigilless variables.
>> https://docs.perl6.org/language/variables#Sigilless_variables
>
> On Thu, May 25, 2017 at 11:10 PM, Gabor Szabo <szab...@gmail.com> wrote:
>>
>> https://docs.perl6.org/language/variables
>> says:
>> "Variable names can start with or without a special character called a
>> sigil,"
>>
>> But then in the examples all 3 have sigils. How can a variable have no
>> sigil?
>>
>> Gabor


Are sigils required?

2017-05-26 Thread Gabor Szabo
https://docs.perl6.org/language/variables
says:
"Variable names can start with or without a special character called a sigil,"

But then in the examples all 3 have sigils. How can a variable have no sigil?

Gabor


Re: Compiling Rakudo in parallel

2017-05-26 Thread Gabor Szabo
That just confuses me :(

Do I need to type

make -j 4

and hope for some concurrency?

or

export MAKEFLAGS="-j2 --load-average=2"
make

as I was pointed to off-list?

Would someone update the README that comes with Rakudo Star with this
information, please?

regards
   Gabor


On Fri, May 26, 2017 at 1:19 AM, Timo Paulssen  wrote:
> Sadly, the majority of rakudo's and nqp's compilation is serialized (due
> to the dependencies between the individual pieces).
>
> If you build more than one backend at the same time, i.e. moar + jvm,
> you can build both in parallel.
>
> On the other hand, the biggest chunk of time is spent compiling the core
> setting, which commonly takes a minute on moarvm.
>
> nqp behaves very similarly.
>
> moarvm on the other hand can compile all .c files at the same time and
> use up as many cores as there are .c files, but it compiles so fast that
> it's hardly worth anything.
>
> hope that helps
>   - Timo


Compiling Rakudo in parallel

2017-05-25 Thread Gabor Szabo
Hi,

is it possible to run any of the compilation and installation phases
of Rakudo in parallel?  (eg. so the "make" will use all the cores in
my Linux machine)

Gabor


Invoking method by name found in variable

2017-05-23 Thread Gabor Szabo
Hi,

given an object $o and the name of a method in $method = "run"
how can I invoke the $o.run() ?

Something like $o.call($method)

Gabor


Modulino in Perl 6

2017-05-02 Thread Gabor Szabo
Using the caller() in Perl 5 one can figure out if the file was loaded
as a module or executed as a script.

In Python one could check if __name__ is equal to "__main__".

Is there some way in Perl 6 to tell if a file was executed directly or
loaded into memory as a module?

regards
Gabor


Smoke testing Perl 6 Modules on Rakudo

2017-04-08 Thread Gabor Szabo
I wonder if this site is really out of date as the dates at the top indicate?
http://smoke.perl6.org/report

If so, is there working version of this report?

Gabor


zef not telling what it is going to test for Uzu

2017-04-08 Thread Gabor Szabo
As I understand from installing a number of Perl 6 modules using zef,
every time before zef starts testing the module it tells the user what
it is going to test, including its version number.

eg. this:

Testing: Net::DNS:ver('1.0.1'):auth('github:retupmoca')

When I try to install Uzu, howerver I don't see this line.
I wonder if this is because Uzu us hosted on Gitlab and not on GitHub or
is something missing from the META file of Uzu or something else?

Uzu lives here: https://gitlab.com/samcns/uzu/

The reason I notice this is because of a bug in Uzu that was
(partially?) fixed, but
I still cannot install with zef: https://gitlab.com/samcns/uzu/issues/1
and I am not sure it is even trying to install the latest version or not.

regards
Gabor


Re: How to limit the list of imported functions?

2017-04-07 Thread Gabor Szabo
That's indeed a good idea for documentation purposes and with the strict
function redeclaration
prevention of Perl 6 it might be sufficient as well.

regards
   Gabor

On Sat, Apr 8, 2017 at 2:27 AM, ToddAndMargo <toddandma...@zoho.com> wrote:

> On 04/07/2017 07:21 AM, Gabor Szabo wrote:
>
>> In perl 5 we can limit which functions are imported by listing them
>> after the name of the module:
>>
>> use Module ('foo', 'bar');
>>
>> When I try the same in Rakudo I get
>>
>> "no EXPORT sub, but you provided positional argument in the 'use'
>> statement"
>>
>>
>> At least in this case:
>>
>> use WWW::Google::Time 'google-time-in';
>>
>> ===SORRY!=== Error while compiling /opt/google_time.pl
>> Error while importing from 'WWW::Google::Time':
>> no EXPORT sub, but you provided positional argument in the 'use' statement
>> at /opt/google_time.pl:2
>> --> use WWW::Google::Time 'google-time-in'⏏;
>>
>> Using Rakudo Star 2017.01
>>
>> regards
>>Gabor
>>
>>
>
> Hi Gabor,
>
> They are working on it.
>
> I like this feature too, not to minimize my code,
> but to figure out where things come from for
> maintainability.
>
> Whist we wait, this is what do, so I can figure out
> where things are coming from:
>
> use File::Which;   #  qw[ which whence ];
> use X11Clipboard;  #`{ qw[ WritePrimaryClipboard,
>WriteSecondaryClipboard,
>ReadPrimaryClipboard, ReadSecondaryClipboard ]; }
>
> HTH,
> -T
>
>
>
> --
> ~~
> Computers are like air conditioners.
> They malfunction when you open windows
> ~~
>


Re: How to limit the list of imported functions?

2017-04-07 Thread Gabor Szabo
thanks!

On Fri, Apr 7, 2017 at 6:04 PM, Elizabeth Mattijsen <l...@dijkmat.nl> wrote:
> https://docs.perl6.org/syntax/need
>
>> On 7 Apr 2017, at 16:59, Gabor Szabo <szab...@gmail.com> wrote:
>>
>> Thanks. I was only looking at https://docs.perl6.org/syntax/use
>>
>> Looking at that doc you linked to, I have a related quest I could not see:
>>
>> Is there a way to tell Rakudo to not to import any function from the module?
>>
>> Gabor
>>
>>
>> On Fri, Apr 7, 2017 at 5:37 PM, Will Coleda <w...@coleda.com> wrote:
>>> Please check the docs at
>>> https://docs.perl6.org/language/modules#Exporting_and_Selective_Importing
>>>
>>> On Fri, Apr 7, 2017 at 10:21 AM, Gabor Szabo <szab...@gmail.com> wrote:
>>>> In perl 5 we can limit which functions are imported by listing them
>>>> after the name of the module:
>>>>
>>>> use Module ('foo', 'bar');
>>>>
>>>> When I try the same in Rakudo I get
>>>>
>>>> "no EXPORT sub, but you provided positional argument in the 'use' 
>>>> statement"
>>>>
>>>>
>>>> At least in this case:
>>>>
>>>> use WWW::Google::Time 'google-time-in';
>>>>
>>>> ===SORRY!=== Error while compiling /opt/google_time.pl
>>>> Error while importing from 'WWW::Google::Time':
>>>> no EXPORT sub, but you provided positional argument in the 'use' statement
>>>> at /opt/google_time.pl:2
>>>> --> use WWW::Google::Time 'google-time-in'⏏;
>>>>
>>>> Using Rakudo Star 2017.01
>>>>
>>>> regards
>>>>   Gabor
>>>
>>>
>>>
>>> --
>>> Will "Coke" Coleda


write string requires an object with REPR MVMOSHandle

2017-03-29 Thread Gabor Szabo
I was running the following buggy code:

sub save {
my $fh = open('data.txt', :w);
LEAVE: $fh.close;
$fh.print("hello\n");
}

save();

(note the : after the LEAVE)
Which if I am not mistaken is basically the same as:


sub save {
my $fh = open('data.txt', :w);
$fh.close;
$fh.print("hello\n");
}

save();


and I kept getting the error in the subject which greatly confused me.

Shouldn't this be something like a "print of closed filehandle" error?

Gabor


Re: Bug report for Crypt::Bcrypt - cannot install

2017-03-28 Thread Gabor Szabo
Thanks for the quick reply.

That looks like a similar issue, but as I can see Crypt::Bcrypt does
not depend on 'if'.
It has this bug on its own :)

Gabor


On Tue, Mar 28, 2017 at 9:45 PM, Will Coleda <w...@coleda.com> wrote:
> Looks like you already found the dependency that is failing:
> https://github.com/FROGGS/p6-if/issues/2
>
> The original module doesn't have a bug queue, and I don't think we
> have a community solution to authors that don't have bugqueues.
> (except to kindly ask them to enable them)
>
>
>
> On Tue, Mar 28, 2017 at 2:33 PM, Gabor Szabo <szab...@gmail.com> wrote:
>> I've just tried to install Crypt::Bcrypt into my Docker based Rakudo
>> but it failed.
>> I checked the GitHub repo of the project
>> https://github.com/skinkade/p6-Crypt-Bcrypt
>> that was linked from modules.perl6.org but it could not find the way
>> to submit bug reports.
>>
>> Where should I report it?
>>
>>
>> # perl6 -v
>> This is Rakudo version 2017.01 built on MoarVM version 2017.01
>> implementing Perl 6.c.
>>
>>
>> # zef install Crypt::Bcrypt
>> ===> Searching for: Crypt::Bcrypt
>> ===> Searching for missing dependencies: Crypt::Random
>> ===> Searching for missing dependencies: if
>> ===> Fetching: Crypt::Bcrypt
>> ===> Fetching: Crypt::Random
>> ===> Fetching: if
>> ===> Building: Crypt::Bcrypt:ver('1.3.1')
>> ===> Building [OK] for Crypt::Bcrypt:ver('1.3.1')
>> ===> Testing: if:ver('0.1.0'):auth('github:FROGGS')
>> t/if.t ..1/5===SORRY!===
>> Cannot find method 'symtable' on object of type GLOBAL
>> # Looks like you planned 5 tests, but ran 1
>> t/if.t .. All 5 subtests passed
>> All tests successful.
>>
>> Test Summary Report
>> ---
>> t/if.t (Wstat: 0 Tests: 1 Failed: 0)
>>   Parse errors: Bad plan.  You planned 5 tests but ran 1.
>> Files=1, Tests=1,  1 wallclock secs
>> Result: FAILED
>> ===> Testing [FAIL]: if:ver('0.1.0'):auth('github:FROGGS')
>> Aborting due to test failure: if:ver('0.1.0'):auth('github:FROGGS')
>> (use --force to override)
>>   in code  at 
>> /usr/share/perl6/site/sources/1DC0BAA246D0774E7EB4F5119C6168E0D8266EFA
>> (Zef::Client) line 306
>>   in method test at
>> /usr/share/perl6/site/sources/1DC0BAA246D0774E7EB4F5119C6168E0D8266EFA
>> (Zef::Client) line 285
>>   in code  at 
>> /usr/share/perl6/site/sources/1DC0BAA246D0774E7EB4F5119C6168E0D8266EFA
>> (Zef::Client) line 457
>>   in sub  at 
>> /usr/share/perl6/site/sources/1DC0BAA246D0774E7EB4F5119C6168E0D8266EFA
>> (Zef::Client) line 454
>>   in method install at
>> /usr/share/perl6/site/sources/1DC0BAA246D0774E7EB4F5119C6168E0D8266EFA
>> (Zef::Client) line 560
>>   in sub MAIN at
>> /usr/share/perl6/site/sources/A9948E7371E0EB9AFDF1EEEB07B52A1B75537C31
>> (Zef::CLI) line 123
>>   in block  at
>> /usr/share/perl6/site/resources/3DD33EF601FD300095284AE7C24B770BAADAF32E
>> line 1
>
>
>
> --
> Will "Coke" Coleda


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

$


Travis-CI and Rakudo seem to be a bit unstable

2017-03-25 Thread Gabor Szabo
Hi,

In addition to me breaking my own code, it seems that Travis-CI and
Rakudo are rather fragile together.

Occasionally my tests fail due to failures in the prerequisites.

This failed due to LWP::Simple failing
https://travis-ci.org/szabgab/Perl6-Maven/jobs/215147392
even though 20 min earlier it worked:
https://travis-ci.org/szabgab/Perl6-Maven/builds/215143736

Yesterday Bailador failed:
https://travis-ci.org/szabgab/Perl6-Maven/jobs/214981400
even though it worked a few minutes earlier and a few minutes later.

As far as I can tell neither LWP::Simple nor Bailador changed during that time.

Have you encountered similar issues?  Am I misreading something?


regards
   Gabor


Re: Failed to open file .. too many open files

2017-03-25 Thread Gabor Szabo
I still get the same error.
I just found another case of slurp-rest which might have been the
cause but it might be good time to
look at the few other cases of "open" in my code. (And later maybe
also the code of Bailador itself.)
I tried to read more about how I am supposed to close file handles in
Perl 6, but the explanation I found didn't help me.
I opened this ticket https://github.com/perl6/doc/issues/1258 asking
for further clarification.

Anyway here is another code snippet from my code:

for open("$.source_dir/authors.txt").lines -> $line {
 ...
}

Do I need to close this myself? Can I rely on Perl closing it?

If I open a file for reading like this:

sub f {
my $fh = open $file, :r;
LEAVE $fh.close;

for $fh.lines -> $line {
}
}

Is that the correct way to put the LEAVE in? Should it be immediately
after the open statement?

And for writing?

sub write {
my $fh = open $file, :w;
LEAVE $fh.close;
$fh.print("text");
}

regards
Gabor


Re: Failed to open file .. too many open files

2017-03-25 Thread Gabor Szabo
On Sat, Mar 25, 2017 at 8:42 PM, Elizabeth Mattijsen  wrote:
> $file.IO.slurp and slurp($file) are basically the same.
>
> $handle.slurp-rest does *not* close the handle, as another process might 
> still be writing to it, so you could do another .slurp-rest.
>
>
> To get back to your original code:
>
>get '/atom' => sub {
>my $path = $.meta ~ request.path;
>return open($path).slurp-rest;
>}
>
> I would write that as:
>
>get '/atom' => sub { slurp $.meta ~ request.path }
>
> Should you wind up with an opened handle, could could use a LEAVE phaser to 
> make sure the handle gets closed:
>
>get '/atom' => sub {
>LEAVE $.meta.handle.close;
>return $.meta.handle.slurp-rest;
>}
>

Thanks.

I've converted all those slurp-rest calls so slurp calls.
I am not sure why did I have the slurp-rest in there.
That code seems to be at least 2 years old.

Anyway, thanks for the explanation.

Gabor


Re: Failed to open file .. too many open files

2017-03-25 Thread Gabor Szabo
Oh so you say that's indeed a bug in my code. That's a relief. Thanks!


As I can see I had some $file.IO.slurp and some of the slurp-rest ones.

What is the difference between $file.IO.slurp and slurp($file) ?
Is the latter just an alias for the former?

Gabor


On Sat, Mar 25, 2017 at 4:54 PM, Timo Paulssen  wrote:
> i highly suggest you slurp instead of open + slurp-rest, because that
> will automatically close the file for you, too.
>
> other than that, you can pass :close to the slurp-rest method and it'll
> also close the file.
>
> if you're not closing the files you're opening, you'll be relying on the
> garbage collector to do file handle closing for you, which is
> nondeterministic and a bad idea in general.
>
> HTH
>   - Timo


Failed to open file .. too many open files

2017-03-25 Thread Gabor Szabo
The Perl 6 Maven site runs on Bailador. I've just updated the Rakudo
underneath to 2017.01 and
it seemed to be working fine, but after a while it started crashing
with this error message:



Failed to open file /home/gabor/work/perl6maven-live.com/main.json:
too many open files
  in sub  at /home/gabor/work/Perl6-Maven/lib/Perl6/Maven.pm6
(Perl6::Maven) line 26
  in block  at 
/home/gabor/rakudo-star-2017.01/install/share/perl6/site/sources/A80D3EE41ED647143B6A367AAE142A5967A850D7
(Bailador::Route) line 57
  in method recurse-on-routes at
/home/gabor/rakudo-star-2017.01/install/share/perl6/site/sources/A80D3EE41ED647143B6A367AAE142A5967A850D7
(Bailador::Route) line 56
  in method dispatch at
/home/gabor/rakudo-star-2017.01/install/share/perl6/site/sources/06F75D046213CAD92B84F66E5F161C084878D0C3
(Bailador::App) line 84
  in block  at 
/home/gabor/rakudo-star-2017.01/install/share/perl6/site/sources/06F75D046213CAD92B84F66E5F161C084878D0C3
(Bailador::App) line 77

I've tried to reproduce the problem by running curl against the local
version of the application,
but so far, after a few hundred requests, I have not encountered the problem.


line 26 in the Maven.pm6 file looks like this:

get '/atom' => sub {
my $path = $.meta ~ request.path;
return open($path).slurp-rest;
}

I wonder if you have any idea what could be the source of this problem?

The full source of the application is here:
https://github.com/szabgab/Perl6-Maven/

regards
Gabor


Perl 6 docs

2017-03-25 Thread Gabor Szabo
When I search for %INC at https://docs.perl6.org/ it offers   "%INC (Perl 5)"
but when I search for the more common @INC

Luckily the former leads to
https://docs.perl6.org/language/5to6-perlvar which also has
information on the latter, but it would be nice if that was also
recognized in the search box.

Gabor


Using Rakudo Start on OSX using the .dmg

2017-03-25 Thread Gabor Szabo
Hi,

I just tried to use the .dmg version of Rakudo Star.
I might not be the typical Mac user as I spent quite some time trying to figure
out what do I need to do in order to start using it after the installation.

In the end I found that it was installed to  /Applications/Rakudo

Then I added these to my .bash_profile:

export RAKUDO=/Applications/Rakudo
export PATH=$RAKUDO/bin:$RAKUDO/share/perl6/site/bin/:$PATH
export PERL6LIB=$RAKUDO/share/perl6/site/lib/

reloaded it and then I could use it.

Maybe some notes like this could be added to
http://rakudo.org/how-to-get-rakudo/

regards
   Gabor


Forking or running external process in background

2015-10-24 Thread Gabor Szabo
I am trying to test the Perl6::Maven web application by launching the full
application (which is uses Bailador) and then accessing the pages using
LWP::Simple.


Unfortunately so far I could not figure out how to launch an external
program in the background
or how to fork an exec ?

I tried QX{"command &") but it waited till the command finished.
I tried run(), but that insisted I pass each argument as a separate value

my $p = run("/usr/bin/perl", "-V", :out);

worked but

my $p = run("/usr/bin/perl -V", :out);

did not seem to work and I cannot pass & to the former.

Gabor


How to profile Perl 6 applications?

2015-10-24 Thread Gabor Szabo
Hi,

The Devel::NYTProf helped me a lot locating the source of slowness on the
Perl Maven site.
Is there something similar for Perl 6 so I can try to improve the speed of
the Perl 6 Maven site too?

Gabor


Re: Method 'send' not found for invocant of class 'IO::Socket::INET'

2015-09-26 Thread Gabor Szabo
Tobias thanks!

I ran panda install HTTP::Easy
and it installed the new version in
/Users/gabor/rakudo-star-2015.09/install/share/perl6/site/lib/HTTP/Easy.pm6

but Rakudo is still loading the old one from

/Users/gabor/rakudo-star-2015.09/install/share/perl6/lib/HTTP/Easy.pm6

and crashing.

I can run

perl6 -I /Users/gabor/rakudo-star-2015.09/install/share/perl6/site/lib/
examples/app.pl

and then it works, but is there something else I should have done to make
rakudo look
for the site module before the one in the old place or to let panda install
over the top of
the old version? Oh and there is also a  .moarvm version of the file.

regards
  Gabor


On Sat, Sep 26, 2015 at 3:37 PM, Tobias Leich <em...@froggs.de> wrote:

> You need to upgrade HTTP::Easy, it already contains a fix.
>
>
> Am 26.09.2015 um 12:26 schrieb Gabor Szabo:
>
> And just to clarify launching this simple script (and then accessing it
> via a browser) would show the same problem:
>
> use lib 'lib';
>
> use Bailador;
>
> get '/' => sub {
> "hello world"
> }
>
> baile;
>
>
> On Sat, Sep 26, 2015 at 1:16 PM, Gabor Szabo <ga...@szabgab.com> wrote:
>
>> In the cloned repository of Bailador I ran
>>
>> perl6 examples/app.pl
>>
>> It launched the web server printing
>>
>> Entering the development dance floor: <http://0.0.0.0:3000>
>> http://0.0.0.0:3000
>> [2015-09-26T10:04:46Z] Started HTTP server.
>>
>> but when I tried to access it with a browser it crashed with:
>>
>> [2015-09-26T10:04:49Z] GET / HTTP/1.1
>> Method 'send' not found for invocant of class 'IO::Socket::INET'
>>   in method run at
>> /Users/gabor/rakudo-star-2015.09/install/share/perl6/lib/HTTP/Easy.pm6:193
>>   in sub baile at /Users/gabor/work/Bailador/lib/Bailador.pm:153
>>   in block  at examples/app.pl:38
>>
>>
>> Any idea what's this and how to fix it?
>>
>> Oh and I found the INET module here:
>> /Users/gabor/rakudo-star-2015.09//rakudo/src/core/IO/Socket/INET.pm
>> it does not even seem to be "installed".
>>
>>
>> regards
>> Gabor
>>
>>
>
>


Re: Method 'send' not found for invocant of class 'IO::Socket::INET'

2015-09-26 Thread Gabor Szabo
And just to clarify launching this simple script (and then accessing it via
a browser) would show the same problem:

use lib 'lib';

use Bailador;

get '/' => sub {
"hello world"
}

baile;


On Sat, Sep 26, 2015 at 1:16 PM, Gabor Szabo <ga...@szabgab.com> wrote:

> In the cloned repository of Bailador I ran
>
> perl6 examples/app.pl
>
> It launched the web server printing
>
> Entering the development dance floor: http://0.0.0.0:3000
> [2015-09-26T10:04:46Z] Started HTTP server.
>
> but when I tried to access it with a browser it crashed with:
>
> [2015-09-26T10:04:49Z] GET / HTTP/1.1
> Method 'send' not found for invocant of class 'IO::Socket::INET'
>   in method run at
> /Users/gabor/rakudo-star-2015.09/install/share/perl6/lib/HTTP/Easy.pm6:193
>   in sub baile at /Users/gabor/work/Bailador/lib/Bailador.pm:153
>   in block  at examples/app.pl:38
>
>
> Any idea what's this and how to fix it?
>
> Oh and I found the INET module here:
> /Users/gabor/rakudo-star-2015.09//rakudo/src/core/IO/Socket/INET.pm
> it does not even seem to be "installed".
>
>
> regards
> Gabor
>
>


Method 'send' not found for invocant of class 'IO::Socket::INET'

2015-09-26 Thread Gabor Szabo
In the cloned repository of Bailador I ran

perl6 examples/app.pl

It launched the web server printing

Entering the development dance floor: http://0.0.0.0:3000
[2015-09-26T10:04:46Z] Started HTTP server.

but when I tried to access it with a browser it crashed with:

[2015-09-26T10:04:49Z] GET / HTTP/1.1
Method 'send' not found for invocant of class 'IO::Socket::INET'
  in method run at
/Users/gabor/rakudo-star-2015.09/install/share/perl6/lib/HTTP/Easy.pm6:193
  in sub baile at /Users/gabor/work/Bailador/lib/Bailador.pm:153
  in block  at examples/app.pl:38


Any idea what's this and how to fix it?

Oh and I found the INET module here:
/Users/gabor/rakudo-star-2015.09//rakudo/src/core/IO/Socket/INET.pm
it does not even seem to be "installed".


regards
Gabor


Re: require on string stopped working in rakudo 2015.09

2015-09-26 Thread Gabor Szabo
On Sat, Sep 26, 2015 at 3:39 PM, Moritz Lenz  wrote:

>
> >> I've fixed my script by switching to EVAL "use $module";
> >> but I wonder if this is a regression or a planned deprecation?
> >
> > I’m not sure yet.
> >
> > Could you please rakudobug it so that it doesn’t fall through the
> cracks?  This change did not fire any spectest alarm either, so maybe we
> need a test for it as well  :-)
>
> I've opened https://rt.perl.org/Ticket/Display.html?id=126096 and later
> rejcted it when learning about the desired behavior.
>
>

Thanks for all the replies. I stick with EVAL for now.

BTW  http://doc.perl6.org/ does not know about 'require' at all.   (nor
seems to know about 'use'). nor EVAL.

Gabor


How to push a hash on an array without flattening it to Pairs?

2015-09-25 Thread Gabor Szabo
In the first two cases the hash was converted to Pairs before assigning to
the array.
Only the third case gave what I hoped for. How can I push a hash onto an
array as a single entity?


use v6;

my %h = x => 6, y => 7;
say %h.perl; #  {:x(6), :y(7)}

my @a = %h;
say @a.elems;   #
say @a[0]; # x => 6



my @c;
@c.push(%h);
say @c.elems; # 2
say @c[0];   # x => 6


my @b;
@b[@b.elems] = %h;
say @b.elems;  # 1
say @b[0];# x => 6, y => 7


require on string stopped working in rakudo 2015.09

2015-09-25 Thread Gabor Szabo
Hi,

I am really glad Rakudo finally came out.
I've installed in and tried to run the tests of Perl6::Maven.

They quickly failed as I have been using 'require' on string
to check if all the module compile properly.

The following code now fails:

use v6;
my $name = 'Bailador';
require $name;


even though

require Bailador;

works.

In 2015.07 both worked.


I've fixed my script by switching to EVAL "use $module";
but I wonder if this is a regression or a planned deprecation?

Gabor


Is creating and Array or Parcel ?

2015-07-31 Thread Gabor Szabo
The following code (with comments) is confusing me.
Can someone give some explanation please?
Specifically the difference between

my @x = a b;
my $z = @x;

and

my $z = a b;

Gabor


use v6;

#   creates an array here:
my @x = a b;
say @x.WHICH;  # Array|140713422866208
say @x;# a b
say @x[0]; # a
@x.push('c');
say @x;# a b c

# we can assign that array to a scalar variable and it is still and array
my $y = @x;
say $y.WHICH; # Array|140498399577376
say $y[0];# a
$y.push('d');
say $y;   # a b c d


# but if we assign the same   construct directly to a scalar
# then we get a Parcel
my $z = a b;
say $z.WHICH; # Parcel|(Str|a)(Str|b)
# $z.push('c');   # Cannot call push(Parcel: Str); none of these signatures
match: (Any:U \SELF: *@values, *%_)

# but if we wrap it in square brackets it creates an array
my $w = [a b];
say $w.WHICH;# Array|140272330353168
say $w[0];   # a
$w.push('c');
say $w;  # a b c


Re: time and now showing different time?

2015-01-12 Thread Gabor Szabo
On Mon, Jan 12, 2015 at 10:35 AM, Tobias Leich em...@froggs.de wrote:

  Also interesting might be the fact that BEGIN statements/blocks do return
 a value:

 say now() - BEGIN now; # parens needed to there so that it does not gobble 
 args


Hmm, actually it does not let me put the parens there:
$ perl6 -e 'say now() - BEGIN now;'

===SORRY!=== Error while compiling -e
Undeclared routine:
now used at line 1

This works:

$ perl6 -e 'say now - BEGIN now;'
0.0467931

but I am not sure why is that interesting. Could you elaborate please?



  One of them counts leap seconds, the other doesn't. Instant is supposed
 to be a monotonic clock, the other isn't.


Oh and Timo,  I think, if I understand this correctly, they are both
monotonic in the mathematical sense.
Neither can decreases, can day?
The difference is that 'time' stops here-and-there and waits for a leap
second to pass before it resumes increasing.

Gabor


Re: time and now showing different time?

2015-01-12 Thread Gabor Szabo
On Mon, Jan 12, 2015 at 11:48 AM, Tobias Leich em...@froggs.de wrote:


 $ perl6 -e 'sleep 3; say now - BEGIN now;'
 3.0180351



Oh, so this what they call bending time around space. (Or was that the
other way around?)
You call now in the BEGIN block which is the first thing to finish in that
code, but it is placed
later in the script so it will appear only after the sleep and the second
now (written as first now)
will have been executed.

It's clear.

:)

Gabor


Could method calls warn in void context?

2015-01-10 Thread Gabor Szabo
I keep writing code like this:

$str.substr(/regex/, 'replaement)

when I should write

$str.=substr(/regex/, 'replaement)


The former will *return* the replaced string to the void but not change it.

I don't know if the above can be ever useful, but maybe this kind of
constructs should warn. Or maybe there should be a flag that will turn
on warnings  for such cases.

Or maybe there already is, I just don't know about it?

Gabor


Memory leak in Rakudo Star 2014.12.1 ?

2015-01-10 Thread Gabor Szabo
I have Rakudo Start 2014.12.1 compiled with MoarVM running on OSX
and it seems to be leaking memory, but I need your help in confirming my
understanding:

I created this script to show it:

use v6;
sub MAIN(Int $count) {
prompt(Start);
for 1 .. $count - $i {
my $x = 42;
}
prompt(Stop);
}

I ran it with 300  and checked the memory footprint using the following

after Start was printed:

$ ps axuw | grep [p]erl6 | perl -n -E 'say join  ,  (split /\s+/ )[4, 5]'
2561364 99788

after Stop was printed:
$ ps axuw | grep [p]erl6 | perl -n -E 'say join  ,  (split /\s+/ )[4, 5]'
2733824 273632

The numbers are VSZ and RSS respectively.

Even in such a simple script it seems that Rakudo is leaking memory.

Gabor


time and now showing different time?

2015-01-10 Thread Gabor Szabo
  say time; say now; say time; say now;

1420898839
Instant:1420898874.659941
1420898839
Instant:1420898874.663946

This looks really strange to me.
Why do the calls to 'now' show different full seconds than the calls to
'time' ?

Gabor


Re: Memory leak in Rakudo Star 2014.12.1 ?

2015-01-10 Thread Gabor Szabo
On Sat, Jan 10, 2015 at 10:25 PM, t...@wakelift.de wrote:


 On 01/10/2015 08:39 PM, Gabor Szabo wrote:
  Well, whatever it is, this means that the web application fills all
  the memory and crashes every 30-40 requests.
  Luckily there are not many people who read the site :)
 
  Gabor
 
 

 I'm expecting you're talking about

 https://github.com/szabgab/Perl6-Maven/

 Can you point me at the actual pieces of code where this problem appears?

 regards
   - Timo



I have not analyzed that yet, I just noticed that if I run the application
then it eats up all
the memory quite quickly. So I wanted to write a small example that is
already doing it and
I started with that for-loop.

A step above that would be a simple script using Bailador:

https://github.com/szabgab/perl6maven.com/blob/main/files/bailador/first.pl

If I launch that and reload it several times I can see how it is is using
more and more memory.
Each number pair is after on request:

2568884 117304   after launch
2577364 119972
2577620 121184
2577864 122924


It is not as bad as the full Perl6::Maven application which gives these
values:
Each number pair is after a single request to the main page which generates
a few more
internal request, but this is one page-view:

2609444 160676   after launch
2649048 194048
2662828 203944
2674000 212256

but of course the Perl6::Maven site loads a JSON file on every request and
uses templates.

Gabor


Re: Missing or wrong version of dependency

2015-01-10 Thread Gabor Szabo
BTW the same happens if I try to run this command in the freshly cloned
copy of https://github.com/supernovus/perl6-http-easy

On Sat, Jan 10, 2015 at 11:28 PM, Gabor Szabo ga...@szabgab.com wrote:

 I have the Rakudo Star installation with HTTP::Easy in it. I was trying to
 play a bit

 with the source code of HTTP::Easy, copied the HTTP/Easy.pm6 file to a
 private lib directory and the

 tried to launch a simple script using Bailador that uses HTTP::Easy.

 perl6 -Ilib sample.pl6

 This is the error I got:

 ===SORRY!===

 Missing or wrong version of dependency
 '/Users/gabor/rakudo-star-2014.12.1/install/languages/perl6/lib/HTTP/Easy.pm6'



 And I have not even changes Easy.pm6 file!
 What does this error mean and what else do I need to to in order to be
 able to use my own copy of this module?

 Gabor





Re: Memory leak in Rakudo Star 2014.12.1 ?

2015-01-10 Thread Gabor Szabo
On Sat, Jan 10, 2015 at 9:01 PM, t...@wakelift.de wrote:


 On 01/10/2015 07:53 PM, Gabor Szabo wrote:

  On Sat, Jan 10, 2015 at 7:57 PM, t...@wakelift.de wrote:

 That happens because the result of the for statement is a list that is
 then sunk; it contains one scalar and one Int object for each iteration
 and rakudo doesn't yet know to throw it away immediately.


  The problem happens even without the internal $x variable, but my main
 problem
 is that this means the web application running the Perl6Maven.com site
 fills the memory
 after just a few requests.

  A quick check seems to indicated that while-loops don't have the same
 memory leak,
 but before I run and rewrite every for loop into a while-loop, it would be
 nice to know
 if there are other parts of the language that are leaking memory?


  regards
   Gabor


 Fortunately, it's not as bad as you think. Compare these two invocations:

 time perl6 -e 'for ^1000 { for ^1000 { }; 1 }'
 0.91user 0.02system 0:00.94elapsed 99%CPU (0avgtext+0avgdata
 113448maxresident)k

 time perl6 -e 'for ^1000 { for ^1 { }; 1 }'
 5.53user 0.02system 0:05.59elapsed 99%CPU (0avgtext+0avgdata
 114744maxresident)k


 The MaxRSS hardly differs, because the list that belongs to the inner for
 loop gets garbage collected properly.

 There isn't an actual memory leak, it's just that the result of the for
 loop is (wrongly) being kept around.

 There was also an optimization that turns a for ^1000 loop into a while
 loop with a native counter for great performance improvements, but that got
 b0rked at some point ;(

 regards
   - Timo


Well, whatever it is, this means that the web application fills all the
memory and crashes every 30-40 requests.
Luckily there are not many people who read the site :)

Gabor


Missing or wrong version of dependency

2015-01-10 Thread Gabor Szabo
 I have the Rakudo Star installation with HTTP::Easy in it. I was trying to
play a bit

with the source code of HTTP::Easy, copied the HTTP/Easy.pm6 file to a
private lib directory and the

tried to launch a simple script using Bailador that uses HTTP::Easy.

perl6 -Ilib sample.pl6

This is the error I got:

===SORRY!===

Missing or wrong version of dependency
'/Users/gabor/rakudo-star-2014.12.1/install/languages/perl6/lib/HTTP/Easy.pm6'



And I have not even changes Easy.pm6 file!
What does this error mean and what else do I need to to in order to be able
to use my own copy of this module?

Gabor


Re: Memory leak in Rakudo Star 2014.12.1 ?

2015-01-10 Thread Gabor Szabo
On Sat, Jan 10, 2015 at 7:57 PM, t...@wakelift.de wrote:

 That happens because the result of the for statement is a list that is
 then sunk; it contains one scalar and one Int object for each iteration
 and rakudo doesn't yet know to throw it away immediately.


The problem happens even without the internal $x variable, but my main
problem
is that this means the web application running the Perl6Maven.com site
fills the memory
after just a few requests.

A quick check seems to indicated that while-loops don't have the same
memory leak,
but before I run and rewrite every for loop into a while-loop, it would be
nice to know
if there are other parts of the language that are leaking memory?


regards
  Gabor


Re: Profiling Perl 6 code

2015-01-05 Thread Gabor Szabo
I tried that and while it was running my hard disk ran out of space. I am
not sure if it is related, but the process crashed and I could not find if
it created anything on the disk. Before trying again, I'd like to remove
anything it might have created. Where should I look for its temporary files?

Gabor

On Wed, Dec 31, 2014 at 11:29 AM, Patrick R. Michaud pmich...@pobox.com
wrote:

 If you're running Rakudo on MoarVM, try the --profile option.  It will
 create an HTML file that shows a lot of useful information, including time
 spent in each routine, call graphs, GC allocations, etc.

 Pm

 On Wed, Dec 31, 2014 at 09:35:33AM +0200, Gabor Szabo wrote:
  The Perl 6 Maven site is a static site generated by some Perl 6 code.
  Currently it takes about 8 minutes to regenerate the 270 pages of the
 site
  which is quite frustrating.
 
  Is there already a tool I could use to profile my code to see which part
  takes the longest time
  so I can focus my optimization efforts in the most problematic area?
 
  regards
 Gabor



External call like Capture::Tiny of Perl 5 ?

2015-01-02 Thread Gabor Szabo
I see there are 'run' and 'shell' functions that return the exit status in
Proc::Status, and QX that returns the output. Wouldn't it be better to have
a function the returns and object that contains both the status, the stdout
and the stderr?

e.g. extending Proc::Status to be able to hold those as well and changing
QX to return
that object?

Gabor


Found no writable directory into which panda could be installed

2014-12-31 Thread Gabor Szabo
After installing Rakudo star into some other directory using --prefix

I tried to run panda and got the following error:



Found no writable directory into which panda could be installed

  in sub make-default-ecosystem at
/home/travis/rakudo-2014-12-1/languages/perl6/lib/Panda/App.pm:18

  in block unit at ./rakudo-2014-12-1/bin/panda:11


It worked when I installed Rakudo Star after building it without any
--prefix.


Is this an integration bug between panda and Rakudo Star?
Can I solve this somehow?

Gabor


Re: Found no writable directory into which panda could be installed

2014-12-31 Thread Gabor Szabo
I found a solution for myself, but I still think this is a problem:

DESTDIR=rakudo-2014-12-1/languages/perl6 ./rakudo-2014-12-1/bin/panda
install YAML

Gabor

On Wed, Dec 31, 2014 at 8:20 PM, Gabor Szabo ga...@szabgab.com wrote:

 After installing Rakudo star into some other directory using --prefix

 I tried to run panda and got the following error:

 

 Found no writable directory into which panda could be installed

   in sub make-default-ecosystem at
 /home/travis/rakudo-2014-12-1/languages/perl6/lib/Panda/App.pm:18

   in block unit at ./rakudo-2014-12-1/bin/panda:11
 

 It worked when I installed Rakudo Star after building it without any
 --prefix.


 Is this an integration bug between panda and Rakudo Star?
 Can I solve this somehow?

 Gabor



Re: Is this a strange regex bug in my code?

2014-12-30 Thread Gabor Szabo
   if not $tmpl ~~ m/\.txt$/ { ... }

fails the same way.

   if not $tmpl ~~ /\.txt$/ { ... }

works like a charm.

Gabor



On Tue, Dec 30, 2014 at 9:48 AM, Patrick R. Michaud pmich...@pobox.com
wrote:

 I suspect it may be some weirdness with the way that $_ is being handled
 in smartmatching, then.

 I think there's a slight difference between

 $tmpl ~~ /regex/

 and

 $tmpl ~~ m/regex/

 The first one does the equivalent of /regex/.ACCEPTS($tmpl), which ends up
 matching $tmpl directly against the regex and returning the resulting Match
 object.

 The second one temporarily assigns $tmpl into $_, then m/regex/ does an
 immediate match against underscore to produce a Match object, which then
 has .ACCEPTS($tmpl) called on it (which returns the Match object).

 I don't know exactly what is happening when !~~ is used with m/.../ --
 i.e., when $_ is being assigned, what is happening to the Match object, and
 where negation is taking place.  It would be interesting to know if the
 following fails for you also:

if not $tmpl ~~ m/\.txt$/ { ... }

 Pm


 On Tue, Dec 30, 2014 at 09:29:39AM +0200, Gabor Szabo wrote:
  No. If I remove the leading m from the regex, then the bug is gone.
  Gabor
 
  On Tue, Dec 30, 2014 at 9:19 AM, Patrick R. Michaud pmich...@pobox.com
  wrote:
 
   Out of curiosity, is the bug still present if you use /\.txt$/ instead
 of
   m/\.txt$/ ?
  
   At the moment it looks like a Rakudo bug to me, but I haven't been
 able to
   golf it further to be certain.
  
   Pm
  
   On Tue, Dec 30, 2014 at 09:11:52AM +0200, Gabor Szabo wrote:
Just to follow-up:
The problem appears in
   
  
 https://github.com/szabgab/Perl6-Maven/commit/4346c96d63e97def55e789bbeebdbdaebe8b0b33
   
After that I have replaced the regex match with
   
if substr($tmpl, *-4) ne '.txt' {
   
that works correctly, but I'd still like to understand if the bug
 was in
   my
code, or if this is some Rakudo issue?
   
Gabor
   
   
  



Profiling Perl 6 code

2014-12-30 Thread Gabor Szabo
The Perl 6 Maven site is a static site generated by some Perl 6 code.
Currently it takes about 8 minutes to regenerate the 270 pages of the site
which is quite frustrating.

Is there already a tool I could use to profile my code to see which part
takes the longest time
so I can focus my optimization efforts in the most problematic area?

regards
   Gabor


Is this a strange regex bug in my code?

2014-12-29 Thread Gabor Szabo
I am puzzled by this.

I have code like this:

my @files = dir($.source_dir).map({ $_.basename });

for @files - $tmpl {

if $tmpl !~~ m/\.txt$/ {

debug(Skipping '$tmpl' it does not end with .txt);

next;

}

debug(Source file $tmpl);

}

and sometimes(!) it skips when it encounters a file called   'perl6-zip.txt'
or a file called 'perl6-write-file.txt'

More specifically when I ran the above code (part of
https://github.com/szabgab/Perl6-Maven )

on https://github.com/szabgab/perl6maven.com on this commit:
https://github.com/szabgab/perl6maven.com/commit/672ca19f8cc0cf893568f93c4c1488c0cd777f7c
  everything worked fine, but when I ran the same code on the next commit (
https://github.com/szabgab/perl6maven.com/commit/75e188288638dea03a0b3329b249f3685859e701
) then suddenly it started to skip those two files.


Re: Is this a strange regex bug in my code?

2014-12-29 Thread Gabor Szabo
No. If I remove the leading m from the regex, then the bug is gone.
Gabor

On Tue, Dec 30, 2014 at 9:19 AM, Patrick R. Michaud pmich...@pobox.com
wrote:

 Out of curiosity, is the bug still present if you use /\.txt$/ instead of
 m/\.txt$/ ?

 At the moment it looks like a Rakudo bug to me, but I haven't been able to
 golf it further to be certain.

 Pm

 On Tue, Dec 30, 2014 at 09:11:52AM +0200, Gabor Szabo wrote:
  Just to follow-up:
  The problem appears in
 
 https://github.com/szabgab/Perl6-Maven/commit/4346c96d63e97def55e789bbeebdbdaebe8b0b33
 
  After that I have replaced the regex match with
 
  if substr($tmpl, *-4) ne '.txt' {
 
  that works correctly, but I'd still like to understand if the bug was in
 my
  code, or if this is some Rakudo issue?
 
  Gabor
 
 



Re: Is there a p6doc equivalent to perltoc?

2013-02-08 Thread Gabor Szabo
There is the index.pl in https://github.com/perl6/doc that generates
the index.data file
and can now list the words it found.
It is a humble beginning of some indexing.

regards
   Gabor

On Fri, Feb 8, 2013 at 6:46 PM, Brian Wisti brian.wi...@gmail.com wrote:
 Hi all,

 Is there a documentation index of some kind accessible to p6doc? I'm
 thinking of something equivalent to `perldoc perltoc`.

 Kind Regards,

 Brian Wisti

 --
 Brian Wisti - a random geek
 http://coolnamehere.com


Cannot bootstrap Panda on Windows

2012-07-27 Thread Gabor Szabo
I just built Rakudo on Windows and tried to set up Panda.
After installing wget I got the following:


C:\work\pandaperl6 bootstrap.pl
SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
syswgetrc = c:\Program Files (x86)\GnuWin32/etc/wgetrc
--2012-07-27 16:13:17--  http://feather.perl6.nl:3000/list
Resolving feather.perl6.nl... 193.200.132.135
Connecting to feather.perl6.nl|193.200.132.135|:3000... connected.
HTTP request sent, awaiting response... 302 Found
Location: projects.json [following]
--2012-07-27 16:13:21--  http://feather.perl6.nl:3000/projects.json
Connecting to feather.perl6.nl|193.200.132.135|:3000... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/json]
Saving to: `C:/Users/Gabor/.panda/projects.json'

[  =
   ] 19,529  43.0K/s   in 0.4s

2012-07-27 16:13:21 (43.0 KB/s) -
`C:/Users/Gabor/.panda/projects.json' saved [19529]

== Fetching File::Tools
== Building File::Tools
Compiling lib/File/Find.pm
'p' is not recognized as an internal or external command,
operable program or batch file.
Mu()
b u i l d   s t a g e   f a i l e d   f o r   F i l e : : T o o l s :
 F a i l e d   b u i l d i n g   l i b / F i l e / F i n d . p m
 i n   b l o c k a t   C : \ w o r k \ p a n d a / l i b / P a
n d a / B u i l d e r . p m : 5 1
 i n   s u b   w i t h p 6 l i b   a t   C : \ w o r k \ p a n d a
/ l i b / P a n d a / C o m m o n . p m : 3 1
 i n   m e t h o d   b u i l d   a t   C : \ w o r k \ p a n d a /
l i b / P a n d a / B u i l d e r . p m : 4 4
 i n   m e t h o d   b u i l d - h e l p e r   a t   C : \ w o r k
\ p a n d a / l i b / P i e s . p m : 5 0
 i n   m e t h o d   r e s o l v e - h e l p e r   a t   C : \ w o
r k \ p a n d a / l i b / P i e s . p m : 8 5
 i n   m e t h o d   r e s o l v e   a t   C : \ w o r k \ p a n d
a / l i b / P i e s . p m : 9 8
 i n   a n y   c a l l _ w i t h _ c a p t u r e   a t   s r c \ g
e n \ M e t a m o d e l . p m : 2 6 8 4
 i n   b l o c k a t   s r c \ g e n \ C O R E . s e t t i n g : 4 4 7
 i n   m e t h o d   r e s o l v e   a t   C : \ w o r k \ p a n d
a / l i b / P a n d a . p m : 8 4
 i n   b l o c k a t   b i n / p a n d a : 8 6
 i n   m e t h o d   r e i f y   a t   s r c \ g e n \ C O R E . s
e t t i n g : 5 0 5 5
 i n   m e t h o d   r e i f y   a t   s r c \ g e n \ C O R E . s
e t t i n g : 4 9 7 6
 i n   m e t h o d   r e i f y   a t   s r c \ g e n \ C O R E . s
e t t i n g : 4 9 7 6
 i n   m e t h o d   g i m m e   a t   s r c \ g e n \ C O R E . s
e t t i n g : 5 3 5 7
 i n   m e t h o d   e a g e r   a t   s r c \ g e n \ C O R E . s
e t t i n g : 5 3 3 6
 i n   m e t h o d   e a g e r   a t   s r c \ g e n \ C O R E . s
e t t i n g : 1 0 8 1
 i n   s u b   e a g e r   a t   s r c \ g e n \ C O R E . s e t t
i n g : 5 6 2 3
 i n   s u b   M A I N   a t   b i n / p a n d a : 8 3
 i n   b l o c k a t   b i n / p a n d a : 1

===SORRY!===
Could not find Shell::Command in any of: , C:\work\panda/lib,
C:\Users\Gabor/.perl6/lib,
C:/work/rakudo/install/lib/parrot/4.4.0-devel/languag
es/perl6/lib


File content is not written if close not called

2012-07-12 Thread Gabor Szabo
The following script leaves and epty 'data.txt' behind.
Only if I call $fh.close is the file contents saved.

Is this a feature?

use v6;

my $fh = open 'data.txt', :w;
$fh.print(hello\n);


Gabor


Where to put examples?

2012-07-04 Thread Gabor Szabo
Neither the META.info specification at
https://github.com/perl6/ecosystem/blob/master/spec.pod
nor http://wiki.perl6.org/Create%20and%20Distribute%20Modules
mentions where one should put example files.

Does that mean they can go in any directory or should those document tell
people to put the examples in the eg/ directory?

BTW Wouldn't it be better to unite the two documents?

regards
   Gabor


Odd number of elements found where hash expected while bootstrapping Panda

2012-07-01 Thread Gabor Szabo
Hi,

after updating Rakudo I started to get these errors so I updated  (git
pull) Pand
removed ~/.perl6 and ~/.panda and tried to bootstrap Panda again:

This is what I got:

$ ./bootstrap.sh
Odd number of elements found where hash expected
  in method STORE at src/gen/CORE.setting:6136
  in block anon at src/gen/CORE.setting:636
  in method BUILDALL at src/gen/CORE.setting:620
  in method bless at src/gen/CORE.setting:610
  in method new at src/gen/CORE.setting:595
  in submethod BUILD at /home/gabor/work/panda/lib/Panda/Ecosystem.pm:31
  in method BUILDALL at src/gen/CORE.setting:625
  in method bless at src/gen/CORE.setting:610
  in method new at src/gen/CORE.setting:595
  in method new at /home/gabor/work/panda/lib/Panda.pm:19
  in block anon at bin/panda:70

===SORRY!===
Could not find Shell::Command in any of: lib, /home/gabor/.perl6/lib,
/home/gabor/work/rakudo_a/install/lib/parrot/4.5.0-devel/languages/perl6/lib


I am tying to track down the issue now but I sort of doubt I can find
it. Your help would be appreciated.

Gabor


showing more than one compilation error?

2012-06-29 Thread Gabor Szabo
Is it possible to get more than one compilation error at once?

Currently after the first undeclared variable Rakudo stops and I have many

Once I fixed them it starts to complain the missing subs...

A bit too much of running and editing and with the current start-up
speed this is a bit discouraging.

regards
   Gabor


Re: Panda with git:// or https:// ?

2012-06-28 Thread Gabor Szabo
On Thu, Jun 28, 2012 at 5:15 PM, Tadeusz Sośnierz
tadeusz.sosni...@onet.pl wrote:
 On Thursday, June 28, 2012 14:32:58 Gabor Szabo wrote:
 In panda all the projects, where there is a source URL, are listed with
 their git:// url except of https://github.com/perlpilot/p6-File-Temp.git
 Where is that?

in projects.json


 I am just wondering why, and if it would not be better if that was
 also using git://
 That's because it was added to the ecosystem with https:// rather than git://.
 Panda doesn't care, for it just uses the url to tell `git clone` where to get
 the source from.

 Some project have no source URL:
 - Druid
 - GGE
 - HTML::Template
 - Lingua::EN::Numbers::Ordinal
 - Perl6::Literate
 - Tardis
 - Test::Mock
 - Text::CSV
 - Yarn
 Those are using the old META.info format, which wanted repo-type and repo-url
 rather than source-url.

 Should the URLs be added? Where?
 Should be, aye, in the modules' META.info files. See
 https://github.com/masak/druid/blob/master/META.info for example.

Is there an explanation or documentation somewhere how those files
should look like
or do people just imitate working packages?
Is there a documentation on how to add a new package to panda?
(where to update projects.json and who could should do that?)

Gabor


Re: Panda with git:// or https:// ?

2012-06-28 Thread Gabor Szabo
On Thu, Jun 28, 2012 at 6:00 PM, Moritz Lenz mor...@faui2k3.org wrote:
 FWIW the reason I always use git:// over https:// is that at some point
 cloning from github via https:// would result in strange errors on the
 client side (iirc something about missing objects).

 I have no idea if that's fixed, but I haven't seen a reason to change back
 to https either.

 Am 28.06.2012 16:48, schrieb Gabor Szabo:

 On Thu, Jun 28, 2012 at 5:15 PM, Tadeusz Sośnierz
 tadeusz.sosni...@onet.pl wrote:

 On Thursday, June 28, 2012 14:32:58 Gabor Szabo wrote:

 In panda all the projects, where there is a source URL, are listed with
 their git:// url except of https://github.com/perlpilot/p6-File-Temp.git

 Where is that?


 in projects.json


 I am just wondering why, and if it would not be better if that was
 also using git://

 That's because it was added to the ecosystem with https:// rather than
 git://.
 Panda doesn't care, for it just uses the url to tell `git clone` where to
 get
 the source from.

 Some project have no source URL:
 - Druid
 - GGE
 - HTML::Template
 - Lingua::EN::Numbers::Ordinal
 - Perl6::Literate
 - Tardis
 - Test::Mock
 - Text::CSV
 - Yarn

 Those are using the old META.info format, which wanted repo-type and
 repo-url
 rather than source-url.

 Should the URLs be added? Where?

 Should be, aye, in the modules' META.info files. See
 https://github.com/masak/druid/blob/master/META.info for example.


 Is there an explanation or documentation somewhere how those files
 should look like
 or do people just imitate working packages?


 http://wiki.perl6.org/Create%20and%20Distribute%20Modules

 I kinda remember that we had more detailed specs somewhere, but currently I
 can't seem to remember where.

Maybe this?
https://github.com/perl6/ecosystem/blob/master/spec.pod

Gabor


Fwd: FOSDEM - perl 6 critic

2011-02-22 Thread Gabor Szabo
hi,

At FOSDEM I met Arne Wichmann who is a long time sysadmin,
Debian developer and Perl user. We had a short chat in which
he expressed his concerns about the complexity,
the size (memory footprint) and speed of Perl 6,

Without even taking in account the current memory requirements
and speed of Rakudo, I guess, even after lots of improvements
we can expect Rakudo to be significantly slower than Perl 5.10
- at least for start-up time - and significantly more memory hungry.
I know it will do a lot more so the comparison is not fair but that's
not the point.

( For a better comparison that takes in account the features as well see
http://www.modernperlbooks.com/mt/2010/07/an-accurate-comparison-of-perl-5-and-rakudo-star.html
)

He, as a sysadmin would like to do the small tasks in a relatively
small language. He would like to make sure the modules/applications
he will download and will have to support are in such a relatively small
language.

I wrote him my opinion but I think it would be important to address these
issues. (Of course if there already is a page somewhere answer these
concerns I'd be happy to just get a link)

Here is his e-mail. (forwarded with permission).

regards
   Gabor

-- Forwarded message --
From: Arne Wichmann a...@anhrefn.saar.de
Date: Mon, Feb 21, 2011 at 4:00 PM
Subject: FOSDEM - perl 6 critic
To: ga...@perl-ecosystem.org


Hi...

You gave me your card when we were leaving FOSDEM, it took me some time to
write a mail...

The topic was: why I am very sceptic about perl6...

First, my background: I am a perl hacker since '91 (or so), but mainly I am
a sysadmin. That means, I do not write a lot of code, but I do a lot of
debugging of other peoples code.

From that background, what I have seen in perl6 does not look like a good
idea to me: it is too complex. When I read other peoples code I have to be
able to understand whatever subset of the perl language they choose to use
- which means I have to be able to grasp any concept used in the language.
And given the number and complexity of operators in perl 6 I do not feel
that this is really doable.

My other gripe is that perl5 nowadays already is too big - it takes too
much memory and time for small tasks. But that is only secondary.

cu

AW
--
[...] If you don't want to be restricted, don't agree to it. If you are
coerced, comply as much as you must to protect yourself, just don't support
it. Noone can free you but yourself. (crag, on Debian Planet)
Arne Wichmann (a...@linux.de)


signature.asc
Description: PGP signature


Re: Fwd: FOSDEM - perl 6 critic

2011-02-22 Thread Gabor Szabo
On Tue, Feb 22, 2011 at 6:14 PM, Guy Hulbert gwhulb...@eol.ca wrote:
 On Tue, 2011-22-02 at 17:57 +0200, Gabor Szabo wrote:
 For a better comparison that takes in account the features as well see
 http://www.modernperlbooks.com/mt/2010/07/an-accurate-comparison-of-perl-5-and-rakudo-star.html

Just to clarify a bit to avoid misunderstandings.
I am not criticizing the speed or memory footprint of Rakudo.
I trust (blindly but still :-) the developers that they will achieve
their goals.

What I am concerned is that people who only get very limited information
about Perl 6 will get (further) be turned off from Perl and Perl 6 due to
whatever reason.

The funny thing is that now that I actually followed the link I provided I can
see I made a similar comment there.

Gabor


Re: Fwd: FOSDEM - perl 6 critic

2011-02-22 Thread Gabor Szabo
On Wed, Feb 23, 2011 at 3:10 AM, Frank S Fejes III fr...@fejes.net wrote:
 On Tue, Feb 22, 2011 at 10:46 AM, Moritz Lenz mor...@faui2k3.org wrote:

 We can't be everybody's darling, as much as we would love to.

 That's a fair statement, however ...

Let me just link to the recent blog post of chromatic:
http://www.modernperlbooks.com/mt/2011/02/unifying-the-two-worlds-of-perl-5.html
and point out the link Aristotle posted:
http://www.nntp.perl.org/group/perl.perl5.porters/2011/02/msg169141.html

He enumerates some of the groups of Perl users that have distinctive
usage patterns.


 [frank@zino00 ~]$ echo a b c | perl -lane 'print $F[1]'
 b
 [frank@zino00 ~]$ echo a b c | perl6 -lane 'print $F[1]'
 ===SORRY!===
 Unable to open filehandle from path '-lane'
 [frank@zino00 ~]$ echo a b c | perl -pe 's/b/BEE/ if /^a/'
 a BEE c
 [frank@zino00 ~]$ echo a b c | perl6 -pe 's/b/BEE/ if /^a/'
 ===SORRY!===
 Unable to open filehandle from path '-pe'


I am not an expert on Perl 6 but I think the fact that those things you
mentioned don't work on the command line of Rakudo is mainly as
they were not *yet* implemented.
They might not be fully specced yet either.

See the draft version of the specification: http://perlcabal.org/syn/S19.html

I am sure the Perl 6 developer would be happy if you could send
them patches implementing some of those option or if at least
you could write tests that check if the features work.

regards
   Gabor


Re: Questions for Survey about Perl

2011-01-02 Thread Gabor Szabo
On Sun, Jan 2, 2011 at 9:48 PM, Guy Hulbert gwhulb...@eol.ca wrote:

 I'm not sure what 'TPF survey' is.

http://survey.perlfoundation.org/

Gabor


  1   2   >