Instantly share code, notes, and snippets.

View p6-Net-LDAP.pm6
use v6;
unit class Net::LDAP;
use NativeCall;
enum LDAP_OPT_X_TLS <NEVER HARD DEMAND ALLOW TRY>;
constant LDAP_SUCCESS = 0;
constant LDAP_VERSION3 = 3;
constant LDAP_OPT_PROTOCOL_VERSION = 0x0011;
constant LDAP_OPT_X_TLS_REQUIRE_CERT = 0x6006;
View Routes.pm6
use Cro::HTTP::Router;
sub r(Str $method, &handler --> Nil) { $*CRO-ROUTE-SET.add-handler($method, &handler) }
sub routes() is export {
route {
get -> {
content 'text/html', '<h1> hello </h1>';
}
r 'LINK', -> {
View fix.diff
diff --git a/src/core/CompUnit/PrecompilationRepository.pm b/src/core/CompUnit/PrecompilationRepository.pm
index 2976e02..16a0eb2 100644
--- a/src/core/CompUnit/PrecompilationRepository.pm
+++ b/src/core/CompUnit/PrecompilationRepository.pm
@@ -244,7 +246,7 @@ class CompUnit::PrecompilationRepository::Default does CompUnit::PrecompilationR
$RMD("id: $dependency.id(), src: $dependency.src(), spec: $dependency.spec()") if $RMD;
my $path = self.store.path($compiler-id, $dependency.id);
if $path.e {
- spurt($path ~ '.rev-deps', "$dependency.id()\n", :append);
+ spurt($path ~ '.rev-deps', "$id\n", :append);
View gist:8c9556cf97fb301f8f84
v6;
grammar BUU {
token TOP { <abc>+ };
token abc { ('a') <bc>* };
token bc { [ ('b') <c>* ]+ }
token c { 'c' };
};
class BuuAbc {
View serialization.md

What I wanna use serialization for

The most pressing use case is loading modules databases Really Fast™. There we we need to be able to deserialize a .moarvm file, which most likely is a structure of hashes and arrays, besides strings representing identifiers and file names. (I would like to serialize CompUnits and IO::Paths directly, but that would not survive a rakudo rebuild. A json backup on the otherhand could serve as a fallback, but that also means we are limited to what json can. Not much.)

View jvm.diff
diff --git a/src/Perl6/Metamodel/BOOTSTRAP.nqp b/src/Perl6/Metamodel/BOOTSTRAP.nqp
index 3c4380d..9156616 100644
--- a/src/Perl6/Metamodel/BOOTSTRAP.nqp
+++ b/src/Perl6/Metamodel/BOOTSTRAP.nqp
@@ -1103,9 +1103,13 @@ BEGIN {
Attribute.HOW.add_method(Attribute, 'new',
nqp::getstaticcode(sub ($self, :$name!, :$type!, :$package!, :$inlined = 0, :$has_accessor,
:$positional_delegate = 0, :$associative_delegate = 0, *%other) {
+ nqp::say('BOOTSTRAP:1106 ' ~ $self.HOW.name($self) ~ ' ' ~ $name);
my $attr := nqp::create($self);
View Ser.pm
unit module Ser;
use nqp;
sub serialize($obj is copy) is export {
my Mu $sh := nqp::list_s();
my $name = 'Ser_' ~ nqp::time_n();
my Mu $sc := nqp::createsc(nqp::unbox_s($name));
nqp::setobjsc($obj, $sc);
nqp::scsetobj($sc, 0, $obj);
my $serialized = nqp::serialize($sc, $sh);
View gist:3ab0151f513b570eeb4e
my %h = 1 => [ [<what what>], [<how how>] ], 2 => [ [<this this>] ];
my $i = 0;
%h.values».map({"{++$i} " Z~ @($^a)}).say;
View perl6-gdb-m.sh
$ perl6-gdb-m -e 'say uniname(nqp::null_s)'
================================================================================================
This is Rakudo Perl 6 running in the GNU debugger, which often allwos to generate useful back-
traces to debug or report issues in Rakudo, the MoarVM backend or the currently running code.
The currently used MoarVM backend is not compiled with debugging symbols, you might want to
reconfigure and reinstall MoarVM with --debug enabled.
This Rakudo version is 2015.3.186.g.260.e.3.cd built on MoarVM version 2015.3.64.g.79.b.6087,
running on ubuntu (14.4.2.LTS.Trusty.Tahr) / linux (81.Ubuntu.SMP.Tue.Mar.24.19.29.48.UTC.2015)
View reports.2015.3
Acme::Meow * True True moar
JSON::Tiny * True True moar
Testing * True True moar
mandelbrot * moar
IO::Prompter * True False moar
Math::Polynomial * True True moar
Math::Vector * True True moar
Math::ContinuedFractions * True True moar
Math::ChebyshevPolynomial * True True moar
Math::OddFunctions * True True moar