Re: Need Inline::Perl5 help
Followup, This is my notes on Inline::Perl5. I hope this is useful to others. -T #!/usr/bin/perl6 # Inline::Perl5 test # Reference: https://github.com/niner/Inline-Perl5/commit/cc683dae98df19db8cfbb551f7a87ef79bdc2a8b use Inline::Perl5; use Term::ANSIColor:from; # my $Red = Term::ANSIColor.RED; # my $Reset = Term::ANSIColor.RESET; my $Red = color('red'); my $Reset = color('reset'); print "High Level method:\n"; print $Red ~ "--Red--" ~ $Reset ~ "\n\n"; print "Low Level method:\n"; my $P5Color = Inline::Perl5.new; $P5Color.use( 'Term::ANSIColor' ); my $ResetColor = "RESET"; print ( $P5Color.call( 'Term::ANSIColor::GREEN' ) ~ "Red\n" ~ $P5Color.call( "Term::ANSIColor::$ResetColor" ) ~ "\n" ); my $p6str = "Perl 6 String"; my $perl5colors = Inline::Perl5.new(); $perl5colors.run(qq{ use Term::ANSIColor qw [ BLUE RESET ]; print "p5 term with color\n" . BLUE . "I am blue\n" . "$p6str" . RESET . "\n\n"; }); print "\'run\' method:\n"; my $perl5 = Inline::Perl5.new(); $perl5.run( ' print "Perl 5\' local time is " . localtime . "\n\n"; ' ); print "Test of return values\n"; my $RetStr = Inline::Perl5.new(); print $RetStr.run(qq{ return ( "P5 return string\n\n" ) });
Re: Need Inline::Perl5 help
On 03/05/2017 09:05 PM, Brock Wilcox wrote: Looks like Term::ANSIColor does weird things with exported constants -- they are some sort of constant-function rather than simple strings. Here is an alternate usage that does what you want: #!/usr/bin/perl6 use Inline::Perl5; use Term::ANSIColor:from ; my $Red = color('red'); my $Reset = color('reset'); print ( $Red ~ "--Red--" ~ $Reset ~ "\n\n" ); You can also refer to this function with Term::ANSIColor::color(...). --Brock Thank you! -- ~~~ Having been erased, The document you're seeking Must now be retyped. ~~~
Re: Need Inline::Perl5 help
Looks like Term::ANSIColor does weird things with exported constants -- they are some sort of constant-function rather than simple strings. Here is an alternate usage that does what you want: #!/usr/bin/perl6 use Inline::Perl5; use Term::ANSIColor:from ; my $Red = color('red'); my $Reset = color('reset'); print ( $Red ~ "--Red--" ~ $Reset ~ "\n\n" ); You can also refer to this function with Term::ANSIColor::color(...). --Brock On Sat, Mar 4, 2017 at 1:15 AM, ToddAndMargowrote: > Hi All, > > I am trying to write myself an example of how > to use Inline::Perl5 (yes, I know there is a way > to write in color in Perl 6). > > I also have a low level test(.use), which I am not > showing, as it works. > > I am doing this in an Xfce 4.12 (Linux) "Terminal". > > > > #!/usr/bin/perl6 > use Inline::Perl5; > use Term::ANSIColor:from; > > my $Red = Term::ANSIColor.RED; > my $Reset = Term::ANSIColor.RESET; > print ( $Red ~ "--Red--" ~ $Reset ~ "\n\n" ); > > > Term::ANSIColor--Red--Term::ANSIColor > ^^ is printing in red > ^^^ is back to black > > Why is it printing out "Term::ANSIColor"? > > Many thanks, > -T > > > Yesterday it worked. > Today it is not working. > Windows is like that. > >
Re: clipboard and ps questions?
On 02/17/2017 06:38 PM, ToddAndMargo wrote: 1) Is there a reliably Perl 6 way to copy things to the clipboard? (Perl 5 has a module, but it is unreliable and I have to make a system call.) In Linux, OS::Clipboard is using xclip and is writing to the "mouse over" and "center click" clipboard, not the ctrl-c/v clipboard. I wrote him about the issue over on https://github.com/kmwallio/p6-OS-Clipboard/issues/1 A quick tutorial on xclip that I wrote myself for the do-it- your-selfers: xclip Reference: https://sourceforge.net/p/xclip/code/HEAD/tree/trunk/xclip.c to write to the secondary clipboard () echo abc | xclip -selection clipboard to read from the secondary clipboard () xclip -selection clipboard -o to write from the primary clipboard (mouse over) echo xyz | xclip -selection primary -o to read from the primary clipboard (center click) xclip -selection primary -o -- ~~ Computers are like air conditioners. They malfunction when you open windows ~~
[perl #130924] [BUG] wrong results for huge double-roped strings
# New Ticket Created by Zoffix Znet # Please include the string: [perl #130924] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=130924 > Expected proper char count or an exception: 16:29 IOninja m: (("a" x 100) x 1073741824).chars.say 16:29 camelia rakudo-moar 9cec31: OUTPUT: «0» 16:31 IOninja m: (('a' x 100) x 100).chars.say 16:31 camelia rakudo-moar 22f43d: OUTPUT: «3567587328»
[perl #130923] [BUG] diacritics on Format characters
# New Ticket Created by Zefram # Please include the string: [perl #130923] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=130923 > > "\x[200b,308]".chars 1 Here I've put an umlaut on a zero-width space, making a single grapheme. This is a bug: these codepoints do not form a single grapheme cluster. U+200b has General_Category=Format, so per UAX #29 qualifies as Grapheme_Cluster_Break=Control, so should always have a grapheme cluster break after it, regardless of the following character. -zefram
[perl #130922] [BUG] grapheme cluster doesn't include Indic prefixed consonants
# New Ticket Created by Zefram # Please include the string: [perl #130922] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=130922 > > "\x[111c2,111c4]".chars 2 The above is erroneous: these two codepoints make up a single extended grapheme cluster. U+111c2 "Sharada sign jihvamuliya" has the property Indic_Syllabic_Category=Consonant_Prefixed, which per UAX #29 makes it a Grapheme_Cluster_Break=Prepend, which means that it falls under rule GB9b, so there should not be an extended grapheme cluster break following it (except when what follows is a control character or end of text). Strangely, the rule about Prepend characters doesn't seem to be being entirely ignored. It is taking effect if the following character is also a Prepend: > "\x[111c2,111c3]".chars 1 -zefram