This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!perl6 | |
role NativeAccessor[&get, &set] { | |
method CALL-ME(*@args) is rw { | |
my $self = @args[0]; | |
Proxy.new( | |
FETCH => sub ($) { | |
&get($self); | |
}, | |
STORE => sub ($, $val ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use NativeCall; | |
class Foo is repr("CStruct") { | |
method foo(Mu:U $type, Int $a ) { | |
my @buff := CArray[$type].new; | |
my $ctype = $type ~~ Num ?? Num !! Int; | |
@buff[$_] = $ctype(0) for ^(10 * $a); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
await IO::Socket::Async.connect('localhost',3333).then( -> $p { | |
if $p.status == Kept { | |
my $conn = $p.result; | |
my $p2 = $conn.send('Hello, Perl 6'); | |
my $p3 = Promise.new; | |
$conn.chars_supply.tap(-> $str { say $str; $p3.keep}); | |
await $p3; | |
$conn.close; | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cannot call AUTOGEN(Audio::Encode::LameMP3: IntTypedCArray[int16], Int, :raw); none of these signatures match: | |
(Audio::Encode::LameMP3 $: @left, @right, *%_ --> Buf) | |
(Audio::Encode::LameMP3 $: @frames, *%_ --> Buf) | |
(Audio::Encode::LameMP3 $: @left, @right, :$raw!, *%_ --> RawEncode) | |
(Audio::Encode::LameMP3 $: @frames, :$raw!, *%_ --> RawEncode) | |
(Audio::Encode::LameMP3 $: IntTypedCArray[int16] $left, IntTypedCArray[int16] $right, Int $frames, *%_ --> Buf) | |
(Audio::Encode::LameMP3 $: IntTypedCArray[int16] $frames-in, Int $frames, *%_ --> Buf) | |
(Audio::Encode::LameMP3 $: IntTypedCArray[int16] $left, IntTypedCArray[int16] $right, Int $frames, :$raw!, *%_ --> RawEncode) | |
(Audio::Encode::LameMP3 $: IntTypedCArray[int16] $frames-in, Int $frames, :$raw!, *%_ --> RawEncode) | |
in sub MAIN at examples/streamfile-encode:37 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The below only happens when the module containing the OO::MOnitors "monitor" is pre-compiled: 28 of OO/Monitors.pm is in a catch, 25 is $!.lock | |
Cannot invoke this object (REPR: Null, cs = 0) | |
at lib/OO/Monitors.pm:28 (/home/jonathan/.rakudobrew/moar-nom/install/share/perl6/site/lib/OO/Monitors.pm.moarvm::11) | |
from <unknown>:1 (/home/jonathan/.rakudobrew/moar-nom/install/share/perl6/site/lib/OO/Monitors.pm.moarvm::18) | |
from lib/OO/Monitors.pm:25 (/home/jonathan/.rakudobrew/moar-nom/install/share/perl6/site/lib/OO/Monitors.pm.moarvm::53) | |
from src/gen/m-Metamodel.nqp:3560 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/Metamodel.moarvm:enter:28) | |
from src/gen/m-CORE.setting:4763 (/home/jonathan/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm:CALL-ME:60) | |
from src/gen/m-BOOTSTRAP.nqp:2752 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/BOOTSTRAP.moarvm::93) | |
from lib/Audio/Libshout.pm:697 (/home/jonathan/.rakudobrew/moar-nom/install/share/perl6/si |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
role Singleton { | |
my $instance; | |
method new(|c) { | |
if not $instance.defined { | |
$instance = self.bless(|c); | |
} | |
$instance; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
role MetamodelX::StaticHOW { | |
method add_method(Mu \type, $name, $code) { | |
say "adding $name with { $code.gist }"; | |
nextsame; | |
} | |
method add_multi_method(Mu \type, $name, $code) { | |
say "adding multi $name with { $code.gist }"; | |
nextsame; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!perl6 | |
use Term::ReadKey:from<Perl5>; | |
ReadMode(4); | |
loop { | |
my $a = ReadKey(0); | |
if $a.defined { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
await IO::Socket::Async.connect('localhost',3333).then( -> $p { | |
if $p.status { | |
given $p.result { | |
.print('Hello, Perl 6'); | |
react { | |
whenever .chars-supply() -> $v { | |
$v.say; | |
done; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl6 | |
use v6; | |
use NCurses; | |
constant numstars = 100; | |
constant screen-x = 80; | |
constant screen-y = 24; | |
constant max-speed = 4; |