Terminal::ANSIColor problem

2017-02-26 Thread ToddAndMargo

Hi All,

Reference: https://github.com/tadzik/Terminal-ANSIColor/

How do I clean this Perl 5 line for Perl 6?

44:  use Terminal::ANSIColor qw( BOLD BLUE RED GREEN RESET );

# perl6 -c CimTrakCheckAndResatart.pl6
===SORRY!=== Error while compiling 
/home/linuxutil/CimTrakCheckAndResatart.pl6

Undeclared names:
BLUE used at line 44
BOLD used at line 44
GREEN used at line 44
RED used at line 44
RESET used at line 44
Undeclared routine:
qw used at line 44


Many thanks,
-T


--
~~~
Serious error.
All shortcuts have disappeared.
Screen. Mind. Both are blank.
~~~


[perl #130867] [BUG] `only` methods are used where `multies` should be, preventing dispatch to Mu.* candidates

2017-02-26 Thread via RT
# New Ticket Created by  Zoffix Znet 
# Please include the string:  [perl #130867]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=130867 >


Some types provide methods, like .Bool, .elems, .Str that are defined for :D 
subtypes. However,
these methods are defined as `only` methods, not `multi`, so the dispatch for 
:U subtypes fails,
instead of those be handled by Mu.* methods.

I already fixed[^1] a bunch for Baggy role, but I notice other types have 
similar issue:

 m: Seq.Bool
 rakudo-moar dd4dfb: OUTPUT: «Invocant requires an instance of 
type Seq, but a type object was passed.  Did you forget a .new?␤  in block 
 at  line 1␤␤»

We need to check the codebase for more of these. I think some construct similar 
to `for Any.^methods(:all)».name -> $name { for @all-core-types { ."$name"() }}`
can be used for automated finding of methods that need to be changed to multies.

[1] 
https://github.com/rakudo/rakudo/commit/e8af8553eae9abfe4f5cd02dcf4114c5c4877c51


Re: Terminal::ANSIColor problem

2017-02-26 Thread yary
On Sun, Feb 26, 2017 at 7:13 AM, ToddAndMargo  wrote:

> Undeclared routine:
> qw used at line 44
>

Use any other bracketing than parens, eg qw[a b c d]  or qw/a b c d/

Parens are used for calling subs/methods so qw(.. ... ...) means "call the
sub named qw"

Fixing that may make the rest work too!

-y


Re: Terminal::ANSIColor problem

2017-02-26 Thread ToddAndMargo

On 02/26/2017 05:12 AM, yary wrote:


On Sun, Feb 26, 2017 at 7:13 AM, ToddAndMargo > wrote:

Undeclared routine:
qw used at line 44


Use any other bracketing than parens, eg qw[a b c d]  or qw/a b c d/

Parens are used for calling subs/methods so qw(.. ... ...) means "call
the sub named qw"

Fixing that may make the rest work too!

-y


Hi Yary,

Thank you!  I am slowly making the p5 to p6 transition!

But, still having an issue:


44:  use Terminal::ANSIColor qw[ BOLD BLUE RED GREEN RESET ];

# perl6 -c CimTrakCheckAndResatart.pl6
===SORRY!=== Error while compiling 
/home/linuxutil/CimTrakCheckAndResatart.pl6

Error while importing from 'Terminal::ANSIColor':
no EXPORT sub, but you provided positional argument in the 'use' statement
at /home/linuxutil/CimTrakCheckAndResatart.pl6:44
--> NSIColor qw[ BOLD BLUE RED GREEN RESET ]⏏;


Now what am I doing wrong?


Many thanks,
-T


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


[perl #130864] [LTA] Error mentions QAST::WVal when using `:(%a)` on a hash

2017-02-26 Thread via RT
# New Ticket Created by  Zoffix Znet 
# Please include the string:  [perl #130864]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=130864 >


14:07   ZzZombo m: my %a=%(kv=>1,delete=>1);my %h=%(abc=>123,bcd=>*);say 
%h<*>:(%a)
14:07   camelia rakudo-moar dd4dfb: OUTPUT: «===SORRY!===␤This type 
(QAST::WVal) does not support positional operations␤»


Re: Terminal::ANSIColor problem

2017-02-26 Thread yary
On Sun, Feb 26, 2017 at 8:21 AM, ToddAndMargo  wrote:

> Now what am I doing wrong?
>

Read the POD!

use Terminal::ANSIColor;
say color('bold'), "this is in bold", color('reset'); 

=head2 C
Given a string with color names, the output produced by C
sets the terminal output so the text printed after it will be colored
as specified. The following color names are recognised:
reset bold underline inverse black red green yellow blue
magenta cyan white default on_black on_red on_green on_yellow
on_blue on_magenta on_cyan on_white on_default
The on_* family of colors correspond to the background colors. One or
three numeric color values in the range 0..255 may also be specified:
N # 256-color map: 8 default + 8 bright + 216 rgb cube + 24 gray
on_N # Same, but background
N,N,N # 24-bit r,g,b foreground color
on_N,N,N # 24-bit r,g,b background color


In short the individual color names are no longer exportable, now use the
"color" sub.
maybe you can export only the "color" sub, and not the other subs that
module exports, if that's what you want for your code.

-y


[perl #130866] [BUG] Crash when using .sort on reified empty Array

2017-02-26 Thread via RT
# New Ticket Created by  Zoffix Znet 
# Please include the string:  [perl #130866]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=130866 >


Filing for records. lizmat++ said will look at this in the future:

 m: .elems, .sort with @
 rakudo-moar dd4dfb: OUTPUT: «This type (List) does not support 
elems␤  in block  at  line 1␤␤»

See IRC: https://irclog.perlgeek.de/perl6-dev/2017-02-26#i_14167690


Re: [perl #130863] [LTA][BUG] Cannot extract partially dimensioned view of array from fixed-size array

2017-02-26 Thread Elizabeth Mattijsen

> On 26 Feb 2017, at 07:06, Itsuki Toyota (via RT) 
>  wrote:
> 
> # New Ticket Created by  Itsuki Toyota 
> # Please include the string:  [perl #130863]
> # in the subject line of all future correspondence about this issue. 
> # https://rt.perl.org/Ticket/Display.html?id=130863 >
> 
> 
> See the following example:
> 
> $ perl6 -e 'my @a; @a = [[1, 2], [3, 4]]; @a[0;*].say;'
> (1 2)
> 
> $ perl6 -e 'my @a[2;2]; @a = [[1, 2], [3, 4]]; @a[0;*].say;'
> Partially dimensioned views of arrays not yet implemented. Sorry. 
>   in block  at -e line 1
> 
> 
> I'm not sure this is a bug or really not yet implemented as the 2nd example 
> says.
> However, "partially dimensioned views of arrays" seems implemented as the 1st 
> example shows.
> 
> 
> $ perl6 --version
> This is Rakudo version 2017.02-58-gd41b68e built on MoarVM version 
> 2017.02-7-g3d85900
> implementing Perl 6.c.

I guess the error at the moment is in the error message, which should read:

"Partially dimensioned views of shaped arrays not yet implemented. Sorry.”


Liz

Re: [perl #130863] [LTA][BUG] Cannot extract partially dimensioned view of array from fixed-size array

2017-02-26 Thread Elizabeth Mattijsen via RT

> On 26 Feb 2017, at 07:06, Itsuki Toyota (via RT) 
>  wrote:
> 
> # New Ticket Created by  Itsuki Toyota 
> # Please include the string:  [perl #130863]
> # in the subject line of all future correspondence about this issue. 
> # https://rt.perl.org/Ticket/Display.html?id=130863 >
> 
> 
> See the following example:
> 
> $ perl6 -e 'my @a; @a = [[1, 2], [3, 4]]; @a[0;*].say;'
> (1 2)
> 
> $ perl6 -e 'my @a[2;2]; @a = [[1, 2], [3, 4]]; @a[0;*].say;'
> Partially dimensioned views of arrays not yet implemented. Sorry. 
>   in block  at -e line 1
> 
> 
> I'm not sure this is a bug or really not yet implemented as the 2nd example 
> says.
> However, "partially dimensioned views of arrays" seems implemented as the 1st 
> example shows.
> 
> 
> $ perl6 --version
> This is Rakudo version 2017.02-58-gd41b68e built on MoarVM version 
> 2017.02-7-g3d85900
> implementing Perl 6.c.

I guess the error at the moment is in the error message, which should read:

"Partially dimensioned views of shaped arrays not yet implemented. Sorry.”


Liz


Re: [perl #130866] [BUG] Crash when using .sort on reified empty Array

2017-02-26 Thread Elizabeth Mattijsen
Fixed with 75e070fdea, TESTS_NEEDED

> On 26 Feb 2017, at 17:25, Zoffix Znet (via RT)  
> wrote:
> 
> # New Ticket Created by  Zoffix Znet 
> # Please include the string:  [perl #130866]
> # in the subject line of all future correspondence about this issue. 
> # https://rt.perl.org/Ticket/Display.html?id=130866 >
> 
> 
> Filing for records. lizmat++ said will look at this in the future:
> 
> m: .elems, .sort with @
> rakudo-moar dd4dfb: OUTPUT: «This type (List) does not support 
> elems␤  in block  at  line 1␤␤»
> 
> See IRC: https://irclog.perlgeek.de/perl6-dev/2017-02-26#i_14167690


Re: Terminal::ANSIColor problem

2017-02-26 Thread yary
Hmm...

use Terminal::ANSIColor;

by itself will import color and everything else. For selectively importing
only what you want- which is good style IMHO- I looked up this

https://docs.perl6.org/language/modules#___top

which says "Note there currently is no way for the user to import a single
object if the module author hasn't made provision for that, and it is not
an easy task at the moment (see RT #127305). One way the author can provide
such access is to give each export trait its own unique tag. (And the tag
can be the object name!) ..."

Maybe the answer is to not try to only import 'color'! More advanced
rakudo-er's please elaborate


Re: Terminal::ANSIColor problem

2017-02-26 Thread Brandon Allbery
On Sun, Feb 26, 2017 at 8:14 PM, ToddAndMargo  wrote:

> Speaking of syntax errors, what is wrong with these
> two lines (not used a the same time)?
>
> use Terminal::ANSIColor qw[ color ];
> use Terminal::ANSIColor::color;
>

The first one attempts to import a symbol "color" from the module
"Terminal::ANSIColor".
The second attempts to import all (or default export) symbols from the
module "Terminal::ANSIColor::color", which doesn't exist.

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


Re: Terminal::ANSIColor problem

2017-02-26 Thread ToddAndMargo

On 02/26/2017 05:56 PM, yary wrote:

Hmm...

use Terminal::ANSIColor;**//___^

by itself will import color and everything else. For selectively
importing only what you want- which is good style IMHO- I looked up this

https://docs.perl6.org/language/modules#___top

which says "Note there currently is no way for the user to import a
single object if the module author hasn't made provision for that, and
it is not an easy task at the moment (see RT #127305). One way the
author can provide such access is to give each |export| trait its own
unique tag. (And the tag can be the object name!) ..."

Maybe the answer is to not try to only import 'color'! More advanced
rakudo-er's please elaborate




Hi Yary,

I do this so I can tell where things come from when I go
back later and try to maintain the code.

My workaround
use Terminal::ANSIColor #  Import "color"

Comments work.

-T


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


[perl #130870] Some self-referential issue with hash assignment (%h1 = %h1, %h2)

2017-02-26 Thread via RT
# New Ticket Created by  Aleks-Daniel Jakimenko-Aleksejev 
# Please include the string:  [perl #130870]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=130870 >


Code:
my %h1 = <1 a 2 b>;
my %h2 = <3 c 4 d>;
my %h3 = <5 e 6 f>;
%h2 = %h1, %h2, %h3;
say %h2

Result:
{1 => a, 2 => b, 5 => e, 6 => f}


Notice that it has everything except for elements of %h2.

If this behavior is correct, then it should throw a warning. But I'd argue that 
it should work exactly the same way as if it was an assignment to a different 
hash.


Re: Terminal::ANSIColor problem

2017-02-26 Thread ToddAndMargo

On 02/26/2017 07:28 AM, yary wrote:


On Sun, Feb 26, 2017 at 8:21 AM, ToddAndMargo > wrote:

Now what am I doing wrong?


Read the POD!


I was over here at

 https://github.com/tadzik/Terminal-ANSIColor/
 "This is a Term::ANSIColor module for Perl 6."

I mistook the above line a meaning a "direct replacement".
So I never went any further.  Had I gone further, it would
have been obvious.

And he doesn't link the POD.  Where is the POD by the way?

And my mistake was that I was calling out stuff on the use
line that did not exist in the module.  I thought my
syntax was messed up (still in P5), especially since
everything else I do wrong is a syntax error.

Speaking of syntax errors, what is wrong with these
two lines (not used a the same time)?

use Terminal::ANSIColor qw[ color ];
use Terminal::ANSIColor::color;

Thank you for the help!
-T




use Terminal::ANSIColor;
say color('bold'), "this is in bold", color('reset'); 


=head2 C

Given a string with color names, the output produced by C
sets the terminal output so the text printed after it will be colored
as specified. The following color names are recognised:

reset bold underline inverse black red green yellow blue
magenta cyan white default on_black on_red on_green on_yellow
on_blue on_magenta on_cyan on_white on_default

The on_* family of colors correspond to the background colors.  One or
three numeric color values in the range 0..255 may also be specified:

N # 256-color map: 8 default + 8 bright + 216 rgb cube + 24 gray
on_N # Same, but background

N,N,N # 24-bit r,g,b foreground color
on_N,N,N # 24-bit r,g,b background color



In short the individual color names are no longer exportable, now use
the "color" sub.
maybe you can export only the "color" sub, and not the other subs that
module exports, if that's what you want for your code.

-y



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


Re: Terminal::ANSIColor problem

2017-02-26 Thread ToddAndMargo

On 02/26/2017 05:14 PM, ToddAndMargo wrote:

And he doesn't link the POD.  Where is the POD by the way?



Found it:

https://github.com/tadzik/Terminal-ANSIColor/commit/c95c318efe6ee1596d012146f4fed7e15f1f316e


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


Re: Terminal::ANSIColor problem

2017-02-26 Thread ToddAndMargo

On 02/26/2017 05:59 PM, ToddAndMargo wrote:

On 02/26/2017 05:14 PM, ToddAndMargo wrote:

And he doesn't link the POD.  Where is the POD by the way?



Found it:

https://github.com/tadzik/Terminal-ANSIColor/commit/c95c318efe6ee1596d012146f4fed7e15f1f316e






This is better:

https://github.com/tadzik/Terminal-ANSIColor/blob/master/example.pl

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


Re: Terminal::ANSIColor problem

2017-02-26 Thread ToddAndMargo

On 02/26/2017 06:02 PM, Brandon Allbery wrote:


On Sun, Feb 26, 2017 at 8:14 PM, ToddAndMargo > wrote:

Speaking of syntax errors, what is wrong with these
two lines (not used a the same time)?

use Terminal::ANSIColor qw[ color ];
use Terminal::ANSIColor::color;


The first one attempts to import a symbol "color" from the module
"Terminal::ANSIColor".
The second attempts to import all (or default export) symbols from the
module "Terminal::ANSIColor::color", which doesn't exist.


Neither work.  What would the proper syntax be?


Re: Terminal::ANSIColor problem

2017-02-26 Thread Brandon Allbery
On Sun, Feb 26, 2017 at 9:38 PM, ToddAndMargo  wrote:

> On 02/26/2017 06:02 PM, Brandon Allbery wrote:
>>
>> On Sun, Feb 26, 2017 at 8:14 PM, ToddAndMargo > > wrote:
>>
>> Speaking of syntax errors, what is wrong with these
>> two lines (not used a the same time)?
>>
>> use Terminal::ANSIColor qw[ color ];
>> use Terminal::ANSIColor::color;
>>
>>
>> The first one attempts to import a symbol "color" from the module
>> "Terminal::ANSIColor".
>> The second attempts to import all (or default export) symbols from the
>> module "Terminal::ANSIColor::color", which doesn't exist.
>>
>
> Neither work.  What would the proper syntax be?
>

It should be the first, but it appears to be unimplemented at present. Only
tagged imports work (
https://docs.perl6.org/language/modules#Exporting_and_Selective_Importing).

"Note there currently is no way for the user to import a single object if
the module author hasn't made provision for that, and it is not an easy
task at the moment (see RT #127305)."

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


Re: [perl #128512] AutoReply: [BUG] utf8-c8 mangles by NFC

2017-02-26 Thread Zefram
This problem no longer occurs.

-zefram


Re: [perl #128511] [BUG] utf8-c8 generates spurious NUL

2017-02-26 Thread Zefram
This problem no longer occurs.

-zefram


Re: Terminal::ANSIColor problem

2017-02-26 Thread ToddAndMargo

On 02/26/2017 06:44 PM, Brandon Allbery wrote:

It should be the first, but it appears to be unimplemented at present.
Only tagged imports work
(https://docs.perl6.org/language/modules#Exporting_and_Selective_Importing).

"Note there currently is no way for the user to import a single object
if the module author hasn't made provision for that, and it is not an
easy task at the moment (see RT #127305)."



Hi Brandon,

That explains it.  Since I am only after making my code more
maintainable, I will just write a comment after the import
so that I can find it in a search.

Thank you for the help!
-T

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