## dist_zef-lizmat-JSON-Fast-Hyper.md
[![Actions Status](https://github.com/lizmat/JSON-Fast-Hyper/actions/workflows/linux.yml/badge.svg)](https://github.com/lizmat/JSON-Fast-Hyper/actions) [![Actions Status](https://github.com/lizmat/JSON-Fast-Hyper/actions/workflows/macos.yml/badge.svg)](https://github.com/lizmat/JSON-Fast-Hyper/actions) [![Actions Status](https://github.com/lizmat/JSON-Fast-Hyper/actions/workflows/windows.yml/badge.svg)](https://github.com/lizmat/JSON-Fast-Hyper/actions)

# NAME

JSON::Fast::Hyper - Read/Write hyperable JSON

# SYNOPSIS

```
use JSON::Fast::Hyper;

my $json = to-json(@array);    # creates faster hyperable JSON

my $json = to-json(%hash);     # normal JSON

my @array = from-json($json);  # 2x faster if hyperable JSON

my %hash := from-json($json);  # normal speed

```

# DESCRIPTION

JSON::Fast::Hyper is a drop-in wrapper for `JSON::Fast`. It provides the same interface as `JSON::Fast`, with two differences:

## CONVERTING A LIST TO JSON

```
my $json = to-json(@array);    # creates faster hyperable JSON

```

When a list is converted to JSON, it will create a special hyperable version of JSON that is still completely valid JSON for all JSON parsers, but which can be interpreted in parallel when reading back. To allow this feature, the JSON will be created ignoring the `:pretty` named argument.

If your data structure is **not** a `Positional`, then it will just act as the normal `to-json` sub from `JSON::Fast`.

## CONVERTING JSON OF A LIST TO DATA STRUCTURE

```
my @array := from-json($json);  # 2x faster if hyperable JSON

```

When the JSON was created hyperable, then reading such JSON with `from-json` will return the original `Positional` as a `List`. If the JSON was not hyperable, it will call the normal `from-json` sub from `JSON::Fast`.

# TECHNICAL BACKGROUND

This module makes the `to-json` and `from-json` exported subs of `JSON::Fast` into a multi. It adds a candidate taking a `Positional` to `to-json`, and it adds a candidate to `from-json` that takes the specially formatted string created by that extra `to-json` candidate.

The `Positional` candidate of `to-json` will create the JSON for each of the elements separately, and joins them together with an additional newline. And then adds a specially formatted header and footer to the result. The resulting string is still valid JSON, readable by any JSON decoder. But when run through the `from-json` sub provided by this module, will decode elements in parallel. Wallclock times are at about 45% (aka 2.2x as fast) for a 13MB JSON file, such as provided by the Raku Ecosystem Archive. While only adding `3 + number of elements` bytes to the resulting string.

A similar approach could be done for handling an `Associative` at the top level. But this makes generally a lot less sense, as the amount of information per key/value is usually vastly different, and JSON that consists of an `Associative` at the top, are usually not big enough to warrant the overhead of hypering.

# AUTHOR

Elizabeth Mattijsen [liz@raku.rocks](mailto:liz@raku.rocks)

Source can be located at: <https://github.com/lizmat/JSON-Fast-Hyper> . Comments and Pull Requests are welcome.

If you like this module, or what I’m doing more generally, committing to a [small sponsorship](https://github.com/sponsors/lizmat/) would mean a great deal to me!

# COPYRIGHT AND LICENSE

Copyright 2022, 2023, 2024, 2025 Elizabeth Mattijsen

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.


## open.md
open

Combined from primary sources listed below.

# [In IO::Handle](#___top "go to top of document")[§](#(IO::Handle)_method_open "direct link")

See primary documentation
[in context](/type/IO/Handle#method_open)
for **method open**.

```raku
method open(IO::Handle:D:
      :$r, :$w, :$x, :$a, :$update,
      :$rw, :$rx, :$ra,
      :$mode is copy,
      :$create is copy,
      :$append is copy,
      :$truncate is copy,
      :$exclusive is copy,
      :$bin,
      :$enc is copy,
      :$chomp = $!chomp,
      :$nl-in is copy = $!nl-in,
      Str:D :$nl-out is copy = $!nl-out,
      :$out-buffer is copy,
    )

```

Opens the handle in one of the modes. [Fails](/routine/fail) with appropriate exception if the open fails.

See description of individual methods for the accepted values and behavior of [`:$chomp`](/type/IO/Handle#method_chomp), [`:$nl-in`](/type/IO/Handle#method_nl-in), [`:$nl-out`](/type/IO/Handle#method_nl-out), and [`:$enc`](/type/IO/Handle#method_encoding). The values for parameters default to the invocant's attributes and if any of them are provided, the attributes will be updated to the new values. Specify `:$bin` set to `True` instead of `:$enc` to indicate the handle should be opened in binary mode. Specifying undefined value as `:$enc` is equivalent to not specifying `:$enc` at all. Specifying both a defined encoding as `:$enc` and `:$bin` set to true will cause `X::IO::BinaryAndEncoding` exception to be thrown.

The open mode defaults to non-exclusive, read only (same as specifying `:r`) and can be controlled by a mix of the following arguments:

｢text｣ without highlighting

```

```

:r      same as specifying   :mode<ro>  same as specifying nothing

:w      same as specifying   :mode<wo>, :create, :truncate
:a      same as specifying   :mode<wo>, :create, :append
:x      same as specifying   :mode<wo>, :create, :exclusive

:update same as specifying   :mode<rw>
:rw     same as specifying   :mode<rw>, :create
:ra     same as specifying   :mode<rw>, :create, :append
:rx     same as specifying   :mode<rw>, :create, :exclusive

```

```

Argument `:r` along with `:w`, `:a`, `:x` are exactly the same as the combination of both letters, shown in the three last rows in the table above. Support for combinations of modes *other* than what is listed above is implementation-dependent and should be assumed unsupported. That is, specifying, for example, `.open(:r :create)` or `.open(:mode<wo> :append :truncate)` might work or might cause the Universe to implode, depending on a particular implementation. This applies to reads/writes to a handle opened in such unsupported modes as well.

The mode details are:

｢text｣ without highlighting

```

```

:mode<ro>  means "read only"
:mode<wo>  means "write only"
:mode<rw>  means "read and write"

:create    means the file will be created, if it does not exist
:truncate  means the file will be emptied, if it exists
:exclusive means .open will fail if the file already exists
:append    means writes will be done at the end of file's current contents

```

```

Attempts to open a directory, write to a handle opened in read-only mode or read from a handle opened in write-only mode, or using text-reading methods on a handle opened in binary mode will fail or throw.

In **6.c** language, it's possible to open path `'-'`, which will cause `open` to open (if `closed`) the `$*IN` handle if opening in read-only mode or to open the `$*OUT` handle if opening in write-only mode. All other modes in this case will result in exception being thrown.

As of **6.d** language version, the use of path `'-'` is deprecated and it will be removed in future language versions entirely.

The `:out-buffer` controls output buffering and by default behaves as if it were [`Nil`](/type/Nil). See method [out-buffer](/routine/out-buffer) for details.

**Note (Rakudo versions before 2017.09): Filehandles are NOT flushed or closed when they go out of scope**. While they *will* get closed when garbage collected, garbage collection isn't guaranteed to get run. This means *you should* use an explicit `close` on handles opened for writing, to avoid data loss, and an explicit `close` is *recommended* on handles opened for reading as well, so that your program does not open too many files at the same time, triggering exceptions on further `open` calls.

**Note (Rakudo versions 2017.09 and after):** Open filehandles are automatically closed on program exit, but it is still highly recommended that you `close` opened handles explicitly.

# [In IO::CatHandle](#___top "go to top of document")[§](#(IO::CatHandle)_method_open "direct link")

See primary documentation
[in context](/type/IO/CatHandle#method_open)
for **method open**.

```raku
method open(IO::CatHandle:D: --> IO::CatHandle:D)
```

Returns the invocant. The intent of this method is to merely make CatHandle workable with things that open [`IO::Handle`](/type/IO/Handle). You never have to call this method intentionally.

# [In IO::Path](#___top "go to top of document")[§](#(IO::Path)_method_open "direct link")

See primary documentation
[in context](/type/IO/Path#method_open)
for **method open**.

```raku
method open(IO::Path:D: *%opts)
```

Opens the path as a file; the named options control the mode, and are the same as the [open](/routine/open) function accepts.

# [In Independent routines](#___top "go to top of document")[§](#(Independent_routines)_sub_open "direct link")

See primary documentation
[in context](/type/independent-routines#sub_open)
for **sub open**.

```raku
multi open(IO() $path, |args --> IO::Handle:D)
```

Creates [a handle](/type/IO/Handle) with the given `$path`, and calls [`IO::Handle.open`](/type/IO/Handle#method_open), passing any of the remaining arguments to it. Note that [`IO::Path`](/type/IO/Path) type provides numerous methods for reading and writing from files, so in many common cases you do not need to `open` files or deal with [`IO::Handle`](/type/IO/Handle) type directly.

```raku
my $fh = open :w, '/tmp/some-file.txt';
$fh.say: 'I ♥ writing Raku code';
$fh.close;

$fh = open '/tmp/some-file.txt';
print $fh.readchars: 4;
$fh.seek: 7, SeekFromCurrent;
say $fh.readchars: 4;
$fh.close;

# OUTPUT: «I ♥ Raku␤»

```


## dist_cpan-MELEZHIK-Sparrowdo-Goss.md
# SYNOPSIS

Sparrowdo module to run goss scenarios.

# Travis build status

[![Build Status](https://travis-ci.org/melezhik/sparrowdo-goss.svg)](https://travis-ci.org/melezhik/sparrowdo-goss)

# INSTALL

```
$ zef install Sparrowdo::Goss

```

# USAGE

Here are few examples.

## Install goss binary

```
$ cat mysql.goss.yaml

module-run 'Goss', %( action => 'install' ); # will install into default location - /usr/bin/goss

module-run 'Goss', %( action => 'install', install_path => '/home/user' ); # will install into users location - /home/user/bin

```

## Runs goss scenarios

Pass goss yaml as is:

```
$ cat mysql.goss.yaml

module-run 'Goss', %( title => 'mysql checks',  yaml => << q:to/HERE/);
  port:
    tcp:3306:
      listening: true
      ip:
      - 127.0.0.1
  service:
    mysql:
      enabled: true
      running: true
  process:
    mysqld:
      running: true
HERE

```

Use your favorite templater to populate goss yamls:

```
$ cat mysql.goss.yaml

  port:
    tcp:{{port}}:
      listening: true

$ cat sparrowfile

use Template::Mustache;

module-run 'Goss', %(
  title => 'mysql tcp port check',
  yaml => Template::Mustache.render('mysql.goss.yaml'.IO.slurp, {  port => '3306' })
);

```

Sets path to goss binary:

```
module-run 'Goss', %( install_path => '/home/user', yaml => '...', title => '...'  );

```

# Author

Alexey Melezhik

# See also

[goss](https://github.com/aelsabbahy/goss)


## nyi.md
class X::NYI

Error due to use of an unimplemented feature

```raku
class X::NYI is Exception { }
```

Error class for unimplemented features. *NYI* stands for *Not Yet Implemented*.

If a Raku compiler is not yet feature complete, it may throw an `X::NYI` exception when a program uses a feature that it can detect and is somehow specified is not yet implemented.

A full-featured Raku compiler must not throw such exceptions, but still provide the `X::NYI` class for compatibility reasons.

A typical error message is

｢text｣ without highlighting

```

```

HyperWhatever is not yet implemented. Sorry.

```

```

# [Methods](#class_X::NYI "go to top of document")[§](#Methods "direct link")

## [method new](#class_X::NYI "go to top of document")[§](#method_new "direct link")

```raku
method new( :$feature, :$did-you-mean, :$workaround)
```

This is the default constructor for `X:NYI` which can take three parameters with obvious meanings.

```raku
class Nothing {
    method ventured( $sub, **@args) {
        X::NYI.new( feature => &?ROUTINE.name,
                    did-you-mean => "gained",
                    workaround => "Implement it yourself" ).throw;
    }
}

my $nothing = Nothing.new;
$nothing.ventured("Nothing", "Gained");

```

In this case, we are throwing an exception that indicates that the `ventured` routine has not been implemented; we use the generic `&?ROUTINE.name` to not tie the exception to the method name in case it is changed later on. This code effectively throws this exception

```raku
# OUTPUT:
# ventured not yet implemented. Sorry.
# Did you mean: gained?
# Workaround: Implement it yourself
#   in method ventured at NYI.raku line 6
#   in block <unit> at NYI.raku line 14

```

Using the exception properties, it composes the message that we see there.

## [method feature](#class_X::NYI "go to top of document")[§](#method_feature "direct link")

Returns a [`Str`](/type/Str) describing the missing feature.

## [method did-you-mean](#class_X::NYI "go to top of document")[§](#method_did-you-mean "direct link")

Returns a [`Str`](/type/Str) indicating the optional feature that is already implemented.

## [method workaround](#class_X::NYI "go to top of document")[§](#method_workaround "direct link")

It helpfully shows a possible workaround for the missing feature, if it's been declared.

## [method message](#class_X::NYI "go to top of document")[§](#method_message "direct link")

Returns the message including the above properties.


## label.md
class Label

Tagged location in the source code

```raku
class Label {}
```

Labels are used in Raku to tag loops so that you can specify the specific one you want to jump to with [statements such as `last`](/language/control#LABELs). You can use it to jump out of loops and get to outer ones, instead of just exiting the current loop or going to the previous statement.

```raku
USERS:          # the label
for @users -> $u {
    for $u.pets -> $pet {
        # usage of a label
        next USERS if $pet.barks;
    }
    say "None of {$u}'s pets barks";
}
say USERS.^name;        # OUTPUT: «Label␤»

```

Those labels are objects of type `Label`, as shown in the last statement. Labels can be used in any loop construct, as long as they appear right before the loop statement.

```raku
my $x = 0;
my $y = 0;
my $t = '';
A: while $x++ < 2 {
    $t ~= "A$x";
    B: while $y++ < 2 {
        $t ~= "B$y";
        redo A if $y++ == 1;
        last A
    }
}
say $t; # OUTPUT: «A1B1A1A2␤»

```

Putting them on the line before the loop or the same line is optional. `Label`s must follow the syntax of [ordinary identifiers](/language/syntax#Ordinary_identifiers), although traditionally we will use the latin alphabet in uppercase so that they stand out in the source. You can use, however, other alphabets like here:

```raku
駱駝道: while True {
  say 駱駝道.name;
  last 駱駝道;
}  # OUTPUT: «駱駝道␤»
```

# [Methods](#class_Label "go to top of document")[§](#Methods "direct link")

## [method name](#class_Label "go to top of document")[§](#method_name "direct link")

Not terribly useful, returns the name of the defined label:

```raku
A: while True {
  say A.name; # OUTPUT: «A␤»
  last A;
}
```

## [method file](#class_Label "go to top of document")[§](#method_file "direct link")

Returns the file the label is defined in.

## [method line](#class_Label "go to top of document")[§](#method_line "direct link")

Returns the line where the label has been defined.

## [method Str](#class_Label "go to top of document")[§](#method_Str "direct link")

Converts to a string including the name, file and line it's been defined in.

## [method next](#class_Label "go to top of document")[§](#method_next "direct link")

```raku
method next(Label:)
```

Begin the next iteration of the loop associated with the label.

```raku
MY-LABEL:
for 1..10 {
    next MY-LABEL if $_ < 5;
    print "$_ ";
}

# OUTPUT: «5 6 7 8 9 10 »
```

## [method redo](#class_Label "go to top of document")[§](#method_redo "direct link")

```raku
method redo(Label:)
```

Repeat the same iteration of the loop associated with the label.

```raku
my $has-repeated = False;

MY-LABEL:
for 1..10 {
    print "$_ ";
    if $_ == 5 {
        LEAVE $has-repeated = True;
        redo MY-LABEL unless $has-repeated;
    }
}

# OUTPUT: «1 2 3 4 5 5 6 7 8 9 10 »
```

## [method last](#class_Label "go to top of document")[§](#method_last "direct link")

```raku
method last(Label:)
```

Terminate the execution of the loop associated with the label.

```raku
MY-LABEL:
for 1..10 {
    last MY-LABEL if $_ > 5;
    print "$_ ";
}

# OUTPUT: «1 2 3 4 5 »
```

# [Typegraph](# "go to top of document")[§](#typegraphrelations "direct link")

Type relations for `Label`

raku-type-graph

Label
Label

Any
Any

Label->Any

Mu
Mu

Any->Mu

[Expand chart above](/assets/typegraphs/Label.svg)


## dist_zef-melezhik-SparrowCI-SandBox.md
# sparrowci-sandbox

The only purpose of this module is to demonstrate
usage of SparrowCI pipeline in Raku module automation.

# sparrow.yaml

This pipeline runs `zef test` and then
if a commit message contains `release!` string
uploads a module via `fez upload`.

Pipeline requires fez token set as secret
in user's account in SparrowCI.

```
image:
  - melezhik/sparrow:debian

secrets:
  - FEZ_TOKEN
tasks:
  -
    name: test
    default: true
    followup:
      -
        name: release
    language: Bash
    code: |
      set -e
      env|grep SCM
      cd source
      zef test .
  -
    name: release
    if:
      language: Raku
      code: |
        update_state %( status => 'skip' )
          unless %*ENV<SCM_COMMIT_MESSAGE> ~~ /'release!'/;
    language: Bash
    code: |
      set -e
      cat << HERE > ~/.fez-config.json
       {"groups":[],"un":"melezhik","key":"$FEZ_TOKEN"}
      HERE

      cd source/
      zef install --/test fez

      tom --clean
      fez upload --unattended

```

# Author

Alexey Melezhik


## dist_github-MattOates-Math-FourierTransform.md
# Math--FourierTransform [Build Status](https://travis-ci.org/MattOates/Math--FourierTransform)

Discrete Fourier Transform for Perl 6

```
use Math::FourierTransform;

@spectrum = discrete-fourier-transform(@data);

```


## dist_cpan-JMERELO-Syslog-Parse.md
[![Build Status](https://travis-ci.com/JJ/raku-syslog-parse.svg?branch=master)](https://travis-ci.com/JJ/raku-syslog-parse)
![.github/workflows/test.yml](https://github.com/JJ/raku-syslog-parse/workflows/.github/workflows/test.yml/badge.svg)

# NAME

Syslog::Parse - Creates a supply out of syslog entries

# SYNOPSIS

```
use Syslog::Parse;

use Syslog::Parse;

my $parser = Syslog::Parse.new;

$parser.parsed.tap: -> $v {
    say $v;
}

sleep( @*ARGS[0] // 120 );

```

Or

```
use Syslog::Parse;
my $parser = Syslog::Parse.new;
Promise.at(now+1).then: {
    shell "logger logging $_" for ^10;
};

react {
    whenever $parser.parsed -> %v {
        say %v;
        done(); # Just interested in the last one
    }
}

```

Also, you can run

```
watch-syslog.p6

```

which is going ot be installed with the distribution.

# DESCRIPTION

Syslog::Parse is a parser that extracts information from every line in `/var/log/syslog`. Creates two objects of the kind `Supply`: one (simply called `.supply` that returns the raw lines, another, `.parsed`, which returns a structure with the following keys:

```
day # Day in the month
month # TLA of month
hour # String with hour
hostname # Hostname that produced it
actor # Who produced the message log
pid # Sometimes, it goes with a PID
message # Another data structure, with key message (the whole message) and
        # user if one has been dentified

```

## PLATFORMS

It works on platforms that use `/var/log/syslog` as a syslog file,
with the same format. All Debian seem to be that way.

If you don't have that platform, you can still use the grammars on
files with that format.

# AUTHOR

JJ Merelo [jjmerelo@gmail.com](mailto:jjmerelo@gmail.com)

# COPYRIGHT AND LICENSE

Copyright 2020 JJ Merelo

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.


## class.md
class

Combined from primary sources listed below.

# [In Object orientation](#___top "go to top of document")[§](#(Object_orientation)_class_class "direct link")

See primary documentation
[in context](/language/objects#Classes)
for **Classes**.

Classes are declared using the `class` keyword, typically followed by a name.

```raku
class Journey { }

```

This declaration results in a type object being created and installed in the current package and current lexical scope under the name `Journey`. You can also declare classes lexically:

```raku
my class Journey { }

```

This restricts their visibility to the current lexical scope, which can be useful if the class is an implementation detail nested inside a module or another class.

# [In Classes and objects](#___top "go to top of document")[§](#(Classes_and_objects)_class_class "direct link")

See primary documentation
[in context](/language/classtut#Class)
for **Class**.

Raku, like many other languages, uses the `class` keyword to define a class. The block that follows may contain arbitrary code, just as with any other block, but classes commonly contain state and behavior declarations. The example code includes attributes (state), introduced through the `has` keyword, and behaviors, introduced through the `method` keyword.


## dist_zef-colomon-ABC.md
```
This module is a set of tools for dealing with ABC music files in Raku (formerly known as Perl 6).

There are several scripts in bin/ built on the library:

* abc2ly: converts an ABC file to the Lilypond ly format, then invokes Lilypond on it to create high quality sheet music.  If you install ABC using zef you should just be able to say

    abc2ly wedding.abc

to convert wedding.abc to wedding.ly and then invoke Lilypond to convert it to
wedding.pdf.

NOTE: Lilypond also has an abc2ly script; last time I tried it it produced
hideous looking output from Lilypond.  If you've got both installed, you will
have to make sure the Raku bin of abc2ly appears first in your PATH.

* abc2book: Given an ABC file and a “book” file, this makes a book PDF.  This uses Lilypond for music formatting, LaTeX for table of contents and index of tunes, and qpdf to stitch the results together into one file.

* abctranspose: Does just what the name implies.

As of 7/6/2020, it works with every recent version of Raku I’ve tried.

```


## dist_zef-raku-community-modules-Dice-Roller.md
[![Actions Status](https://github.com/raku-community-modules/Dice-Roller/actions/workflows/linux.yml/badge.svg)](https://github.com/raku-community-modules/Dice-Roller/actions) [![Actions Status](https://github.com/raku-community-modules/Dice-Roller/actions/workflows/macos.yml/badge.svg)](https://github.com/raku-community-modules/Dice-Roller/actions) [![Actions Status](https://github.com/raku-community-modules/Dice-Roller/actions/workflows/windows.yml/badge.svg)](https://github.com/raku-community-modules/Dice-Roller/actions)

# NAME

Dice::Roller - Roll RPG-style polyhedral dice

# SYNOPSIS

```
use Dice::Roller;

my $dice = Dice::Roller.new("2d6 + 1");
$dice.roll;
say $dice.total;    # 4. Chosen by fair dice roll.
$dice.set-max;
say $dice.total;    # 13

```

# DESCRIPTION

Dice::Roller is the second of my forays into learning Raku. The aim is simple - take a "dice string" representing a series of RPG-style dice to be rolled, plus any modifiers, parse it, and get Raku to virtually roll the dice involved and report the total.

It is still under development, but in its present form supports varied dice expressions adding and subtracting fixed modifiers or additional dice, as well as the "keep highest *n*" notations.

# METHODS

## new

```
my $dice = Dice::Roller.new('3d6 + 6 + 1d4');

```

`.new` takes a single argument (a dice expression) and returns a `Dice::Roller` object representing that collection of dice.

The expression syntax used is the shorthand that is popular in RPG systems; rolls of a group of similar dice are expressed as d, so 3d6 is a set of 3 six-sided dice, numbered 1..6. Additional groups of dice with different face counts can be added and subtracted from the total, as well as fixed integer values.

Preliminary support for some "selectors" is being added, and are appended to the dice identifier; rolling '4d6:kh3' stands for roll 4 d6, then keep the highest 3 dice. Selectors supported are:

* **:kh** - keep the highest *n* dice from this group.
* **:kl** - keep the lowest *n* dice from this group.
* **:dh** - drop the highest *n* dice from this group.
* **:dl** - drop the lowest *n* dice from this group.

Selectors can be chained together, so rolling '4d6:dh1:dl1' will drop the highest and lowest value dice.

## roll

```
$dice.roll;

```

Sets all dice in the expression to new random face values. Returns the `Dice::Roller` object for convenience, so you can do:

```
say $dice.roll.total;

```

## total

```
my $persuade-roll = Dice::Roller.new('1d20 -2').roll;
my $persuade-check = $persuade-roll.total;

```

Evaluates the faces showing on rolled dice including any adjustments and returns an `Int` total for the roll.

# ERROR HANDLING

`Dice::Roller.new` throws an exception if the string failed to parse.

This behaviour might change in a future release.

# DEBUGGING

You can get the module to spew out a bit of debugging text by setting `Dice::Roller::debug = True`. You can also inspect the Match object ini a given roll: `say $roll.match.gist`;

# AUTHOR

James Clark

# COPYRIGHT AND LICENSE

Copyright 2016 - 2017 James Clark

Copyright 2024 Raku Community

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.


## dist_github-codesections-Pod-Literate.md
[![Actions Status](https://github.com/codesections/pod-literate/workflows/test/badge.svg)](https://github.com/codesections/pod-literate/actions)

# NAME

Pod::Literate - A library for parsing Raku files into Pod and Code

# SYNOPSIS

```
use Pod::Literate;
Pod::Literate.parsefile($filename.IO);

```

# DESCRIPTION

Pod::Literate is an extremely simple library for parsing Raku source files into Pod blocks and Code blocks (i.e., everything that isn't a Pod block). The goal of doing so is to support basic [literate programming](https://en.wikipedia.org/wiki/Literate_programming) in Raku. Pod::Literate is intended to be used with Pod::Weave::To::$format and/or Pod::Tangle.

For additional details, please see the announcement blog post: [www.codesections.com/blog/weaving-raku](https://www.codesections.com/blog/weaving-raku).

# AUTHOR

codesections [daniel@codesections.com](mailto:daniel@codesections.com)

# COPYRIGHT AND LICENSE

ⓒ 2020 Daniel Sockwell

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.


## dist_cpan-FCO-JSON-Stream.md
[![Build Status](https://travis-ci.org/FCO/JSON-Stream.svg?branch=master)](https://travis-ci.org/FCO/JSON-Stream)

# JSON::Stream

A JSON stream parser

```
use JSON::Stream;

```

```
react whenever json-stream "a-big-json-file.json".IO.open.Supply, '$.employees.*' -> (:$key, :$value) {
    say "$key => $value<name> - $value<age>"
}

# OUTPUT:
# $.employees.0 => John - 40
# $.employees.1 => Peter - 30

```

Having this as an example of 'a-big-json-file.json'

```
{
    "employees": [
        { "name": "John",  "age": 40 },
        { "name": "Peter", "age": 30 }
    ]
}

```

## Warning

It doesn't validate the JSON. That's good for cases where the JSON isn't properly terminated. Example:

```
react whenever json-stream Supply.from-list(< { "bla" : [1,2,3,4], >), '$.bla.*' -> (:key($), :$value) {
   say $value
}

# OUTPUT:
# 1
# 2
# 3
# 4

```

### sub json-stream

```
sub json-stream(
    Supply $supply,
    +@subscribed
) returns Supply

```

Receives an supply and a list of simplified json-path strings


## dist_zef-rir-Touch.md
NAME

Touch -- set file modified and/or accessed time

SYNOPSIS

use Touch;

touch( $filename ); # update both to now
touch( $filename, $access, $modify ); # update both
touch( $filename, :$access!, :$modify! ); # update both
touch( $filename, :$access!, :only! ); # update access only
touch( $filename, :$access! ); # update access, set mtime to now
touch( $filename, :$modify!, :only! ); # update modify only
touch( $filename, :$modify! ); # update atime, set atime to now

DESCRIPTION

Touch is a wrapping of Cs utimensat call. It allows the
setting of file access and modify times.

The Instant type is used to express all time values seen
in Raku. Instants being passed to C representing
times in the years from 1939 to 2285 inclusive are valid.
The formal limits are in $MIN-POSIX and $MAX-POSIX as
posix time values.

When an access or modify argument is absent, its default is now.
Use the :only flag to leave the absent timestamp unchanged.
All given arguments must be defined. :ONLY is deprecated.
Exceptions have been added.

Symlinks are always followed. Acting on symlinks directly is not
supported. This mirrors Raku's behavior when when reading file
times.

CAVEATS

Alpha code. Run the tests. If tests fail, you may increase the
lag allowance for writing and reading back a timestamp. Set $TESTLAG
in the environment. 0.01 second is the default.

The calling interface is not to be considered stable yet. There
are no plans to change. Feedback is welcome, It is supposed to be
accomodating and easy.

AUTHOR

Robert Ransbottom

SEE ALSO

joy / the clouds / ride the zephyr / warm they smile / die crying

COPYRIGHT AND LICENSE

Copyright 2021-2023 Robert Ransbottom.

This library is free software; you can redistribute it and/or modify it
under the Artistic License 2.0.


## dist_zef-FCO-ASTQuery.md
[![Actions Status](https://github.com/FCO/ASTQuery/actions/workflows/test.yml/badge.svg)](https://github.com/FCO/ASTQuery/actions)

# NAME

ASTQuery - Query and manipulate Raku’s Abstract Syntax Trees (RakuAST) with an expressive syntax

# SYNOPSIS

```
use ASTQuery;

# Sample Raku code
my $code = q{
    for ^10 {
        if $_ %% 2 {
            say $_ * 3;
        }
    }
};

# Generate the AST
my $ast = $code.AST;

# Example 1: Find 'apply-op' nodes where left operand is 1 and right operand is 3
my $result1 = $ast.&ast-query('.apply-op[left=1, right=3]');
say $result1.list;  # Outputs matching nodes

```

## Output

```
[
  RakuAST::ApplyInfix.new(
    left  => RakuAST::IntLiteral.new(1),
    infix => RakuAST::Infix.new("*"),
    right => RakuAST::IntLiteral.new(3)
  )
]

```

# DESCRIPTION

ASTQuery simplifies querying and manipulating Raku’s ASTs using a powerful query language. It allows precise selection of nodes and relationships, enabling effective code analysis and transformation.

## Key Features

* Expressive Query Syntax: Define complex queries to match specific AST nodes.
* Node Relationships: Use operators to specify parent-child and ancestor-descendant relationships.
* Named Captures: Capture matched nodes for easy retrieval.
* AST Manipulation: Modify the AST for code transformations and refactoring.

# QUERY LANGUAGE SYNTAX

## Node Description

Format:

`RakuAST::Class::Name.group#id[attr1, attr2=attrvalue]$name`

Components:

* `RakuAST::Class::Name`: (Optional) Full class name.
* `.group`: (Optional) Node group (predefined).
* `#id`: (Optional) Identifier attribute.
* `[attributes]`: (Optional) Attributes to match.
* `$name`: (Optional) Capture name.

Note: Use only one $name per node.

## Operators

* `>` : Left node has the right node as a child.
* `<` : Right node is the parent of the left node.
* `>>>`: Left node has the right node as a descendant (any nodes can be between them).
* `>>`: Left node has the right node as a descendant, with only ignorable nodes in between.
* `<<<`: Right node is an ancestor of the left node (any nodes can be between them).
* `<<`: Right node is an ancestor of the left node, with only ignorable nodes in between.

Note: The space operator is no longer used.

## Ignorable Nodes

Nodes skipped by `>>` and `<<` operators:

* `RakuAST::Block`
* `RakuAST::Blockoid`
* `RakuAST::StatementList`
* `RakuAST::Statement::Expression`
* `RakuAST::ArgList`

# EXAMPLES

## Example 1: Matching Specific Infix Operations

```
# Sample Raku code
my $code = q{
    for ^10 {
        if $_ %% 2 {
            say 1 * 3;
        }
    }
};

# Generate the AST
my $ast = $code.AST;

# Query to find 'apply-op' nodes where left=1 and right=3
my $result = $ast.&ast-query('.apply-op[left=1, right=3]');
say $result.list;  # Outputs matching 'ApplyOp' nodes

```

### Output

```
[
  RakuAST::ApplyInfix.new(
    left  => RakuAST::IntLiteral.new(1),
    infix => RakuAST::Infix.new("*"),
    right => RakuAST::IntLiteral.new(3)
  )
]

```

Explanation:

* The query `.apply-op[left=1, right=3]` matches ApplyOp nodes with left operand 1 and right operand 3.

## Example 2: Using the Ancestor Operator `<<<` and Named Captures

```
# Sample Raku code
my $code = q{
    for ^10 {
        if $_ %% 2 {
            say $_ * 3;
        }
    }
};

# Generate the AST
my $ast = $code.AST;

# Query to find 'Infix' nodes with any ancestor 'conditional', and capture 'IntLiteral' nodes with value 2
my $result = $ast.&ast-query('RakuAST::Infix <<< .conditional$cond .int#2$int');
say $result.list;  # Outputs matching 'Infix' nodes
say $result.hash;  # Outputs captured nodes under 'cond' and 'int'

```

### Output

```
[
  RakuAST::Infix.new("%%"),
  RakuAST::Infix.new("*")
]
{
  cond => [
    RakuAST::Statement::If.new(
      condition => RakuAST::ApplyInfix.new(
        left  => RakuAST::Var::Lexical.new("$_"),
        infix => RakuAST::Infix.new("%%"),
        right => RakuAST::IntLiteral.new(2)
      ),
      then => RakuAST::Block.new(...)
    )
  ],
  int => [
    RakuAST::IntLiteral.new(2),
    RakuAST::IntLiteral.new(2)
  ]
}

```

Explanation:

* The query `RakuAST::Infix <<< .conditional$cond .int#2$int`:
* Matches Infix nodes that have an ancestor matching `.conditional$cond`, regardless of intermediate nodes.
* Captures IntLiteral nodes with value 2 as $int.
* Access the captured nodes using $result and $result.

## Example 3: Using the Ancestor Operator `<<` with Ignorable Nodes

```
# Find 'Infix' nodes with an ancestor 'conditional', skipping only ignorable nodes
my $result = $ast.&ast-query('RakuAST::Infix << .conditional$cond');
say $result.list;  # Outputs matching 'Infix' nodes
say $result.hash;  # Outputs captured 'conditional' nodes

```

Explanation:

* The query RakuAST::Infix << .conditional$cond:
* Matches Infix nodes that have an ancestor .conditional$cond, with only ignorable nodes between them.
* Captures the conditional nodes as $cond.

## Example 4: Using the Parent Operator < and Capturing Nodes

```
# Sample Raku code
my $code = q{
    for ^10 {
        if $_ %% 2 {
            say $_ * 2;
        }
    }
};

# Generate the AST
my $ast = $code.AST;

# Query to find 'ApplyInfix' nodes where right operand is 2 and capture them as '$op'
my $result = $ast.&ast-query('RakuAST::Infix < .apply-op[right=2]$op');
say $result<op>;  # Captured 'ApplyInfix' nodes

```

### Output

```
[
  RakuAST::ApplyInfix.new(
    left  => RakuAST::Var::Lexical.new("$_"),
    infix => RakuAST::Infix.new("*"),
    right => RakuAST::IntLiteral.new(2)
  )
]

```

Explanation:

* The query `RakuAST::Infix < .apply-op[right=2]$op`:
* Matches ApplyOp nodes with right operand 2 whose parent is an Infix node.
* Captures the ApplyOp nodes as $op.

## Example 5: Using the Descendant Operator `>>>` and Capturing Variables

```
# Sample Raku code
my $code = q{
    for ^10 {
        if $_ %% 2 {
            say $_;
        }
    }
};

# Generate the AST
my $ast = $code.AST;

# Query to find 'call' nodes that have a descendant 'Var' node and capture the 'Var' node as '$var'
my $result = $ast.&ast-query('.call >>> RakuAST::Var$var');
say $result.list;  # Outputs matching 'call' nodes
say $result.hash;  # Outputs the 'Var' node captured as 'var'

```

### Output

```
[
  RakuAST::Call::Name::WithoutParentheses.new(
    name => RakuAST::Name.from-identifier("say"),
    args => RakuAST::ArgList.new(
      RakuAST::Var::Lexical.new("$_")
    )
  )
]
{ var => RakuAST::Var::Lexical.new("$_") }

```

Explanation:

* The query `.call >>> RakuAST::Var$var`:
* Matches call nodes that have a descendant Var node, regardless of intermediate nodes.
* Captures the Var node as $var.
* Access the captured Var node using $result.

# RETRIEVING MATCHED NODES

The ast-query function returns an ASTQuery object with:

* `@.list`: Matched nodes.
* `%.hash`: Captured nodes.

Accessing captured nodes:

```
# Perform the query
my $result = $ast.&ast-query('.call#say$call');

# Access the captured node
my $call_node = $result<call>;

# Access all matched nodes
my @matched_nodes = $result.list;

```

# THE ast-query FUNCTION

Usage:

```
:lang<raku> my $result = $ast.&ast-query('query string');

```

Returns an ASTQuery object with matched nodes and captures.

# GET INVOLVED

Visit the [ASTQuery repository](https://github.com/FCO/ASTQuery) on GitHub for examples, updates, and contributions.

## How You Can Help

* Feedback: Share your thoughts on features and usability.
* Code Contributions: Add new features or fix bugs.
* Documentation: Improve tutorials and guides.

Note: ASTQuery is developed by Fernando Corrêa de Oliveira.

# DEBUG

For debugging, use the `ASTQUERY_DEBUG` env var.

![Trace example](./trace.png)

# CONCLUSION

ASTQuery empowers developers to effectively query and manipulate Raku’s ASTs, enhancing code analysis and transformation capabilities.

# DESCRIPTION

ASTQuery is a way to match RakuAST

# AUTHOR

Fernando Corrêa de Oliveira [fernandocorrea@gmail.com](mailto:fernandocorrea@gmail.com)

# COPYRIGHT AND LICENSE

Copyright 2024 Fernando Corrêa de Oliveira

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.


## dist_zef-tbrowder-Foo-Bar.md
[![Actions Status](https://github.com/tbrowder/Foo-Bar/actions/workflows/linux.yml/badge.svg)](https://github.com/tbrowder/Foo-Bar/actions) [![Actions Status](https://github.com/tbrowder/Foo-Bar/actions/workflows/macos.yml/badge.svg)](https://github.com/tbrowder/Foo-Bar/actions) [![Actions Status](https://github.com/tbrowder/Foo-Bar/actions/workflows/windows.yml/badge.svg)](https://github.com/tbrowder/Foo-Bar/actions)

# NAME

**Foo::Bar** is a dummy module for testing Mi6::Helper development

# SYNOPSIS

```
use Foo::Bar;

```

# DESCRIPTION

**Foo::Bar** is a test module with one file in the /resources directory, but no corresponding entry in the META6.json file.

# AUTHOR

Tom Browder [tbrowder@acm.org](mailto:tbrowder@acm.org)

# COPYRIGHT AND LICENSE

© 2024 Tom Browder

This library is free software; you may redistribute it or modify it under the Artistic License 2.0.


## dist_zef-vrurg-Log-Dispatch.md
# NAME

`Log::Dispatch` - Dispatching multi-source, multi-destination logging

# SYNOPSIS

```
use Log::Dispatch;
use Log::Dispatch::Destination;
use Log::Dispatch::Source;

class DBDestination does Log::Ddispatch::Destination {
    method report(Log::Dispatch::Msg:D $message) {
        ... # Implement writing log messages to a database table
    }
}

class MyApp does Log::Dispatch::Source {
    has Log::Dispatch:D $!logger .= new;
    has Str:D $.log-file is required;
    submethod TWEAK {
        $!logger.add: Log::Dispatch::TTY, :max-level(LOG-LEVEL::DEBUG);
        $!logger.add: 'File', file => $!log-file;
        $!logger.add: DBDestination;
    }
    method do-an-action {
        my Bool $success;
        my $diagnostics;

        self.log: :debug, "Trying an action...";

        ... # Do something

        if $success {
            self.log: "All done";
        }
        else {
            self.log: :critical, "Something is wrong! Cause: ", $diagnostics;
        }
    }
}

```

# DESCRIPTION

This module provide a means to have multiple log destinations withing single application with extra hassle but with easy support for concurrency.

## Model

The model this module is based upon is built around a single dispatcher, which can be considered as a minimalistic wrapper around a [`Supplier`](https://docs.raku.org/type/Supplier). The dispatcher accepts message objects from sources and dispatches them into destinations.

A source here is any instance of a class consuming [`Log::Dispatch::Source`](docs/md/Log/Dispatch/Source.md) role.

A destination is an instance of a class consuming [`Log::Dispatch::Destination`](docs/md/Log/Dispatch/Destination.md) role. It represented an endpoint where messages are to be submitted to.

For example, one may have an application and wants to log its messages into a file and on the console. This is as simple as adding `does Log::Dispatch::Source` to the declaration of our application class. And by having something like the following example anywhere in application code:

```
my $logger = Log::Dispatch.new;
$logger.add: 'File', :max-level(LOG-LEVEL::DEBUG), $log-file-name;
$logger.add: Log::Dispatch::TTY;

```

Note that the application would then log all messages into a log file, but only the essential ones to the console.

It worth to mention that each destination code is by default gets its own thread. For a source it is normally sufficient just to use `log` method provided by [`Log::Dispatch::Source`](docs/md/Log/Dispatch/Source.md) role.

## Processors

A *processor* is an end-point attached to the dispatcher. The module provides two kinds of processors: source and destination implemented, correspondingly, by [`Log::Dispatch::Source`](docs/md/Log/Dispatch/Source.md) and [`Log::Dispatch::Destination`](docs/md/Log/Dispatch/Destination.md) roles.

`Log::Dispatch::Processor` role is just an interface requiring `attach` method to be implemented.

## Destinations

Currently the module only provides two destination end-points: [`Log::Dispatch::TTY`](docs/md/Log/Dispatch/TTY.md) and [`Log::Dispatch::File`](docs/md/Log/Dispatch/File.md). Syslog support may be added later.

## Performance

The multi-destination concept with per-destination maximum log-level support implies that there is no way to optimize away some possibly unused calls to the method `log` because any message, no matter what log-level it is assigned with, must be accepted and emitted into dispatcher's [`Supply`](https://docs.raku.org/type/Supply).

## Log Levels

The number and names of log levels are taken from *syslog* standard exactly for the reason it is the most common logging standard existing around.

Levels are provided as `LOG-LEVEL` enum values declared by [`Log::Dispatch::Types`](docs/md/Log/Dispatch/Types.md) module. Here is the list in the ascending order:

* `EMERGENCY`, which is *0*
* `ALERT`
* `CRITICAL`
* `ERROR`
* `WARNING`
* `NOTICE`
* `INFO` – the per-destination default
* `DEBUG`

## Non-polluting

This module tries to reduce namespace pollution to the absolute minimum. The only symbol exported is `LOG-LEVEL` enumeration type for comparatively simple registration of a destination, as in the above example from the [Model](#Model) section.

# METHODS

### `multi method add(Log::Dispatch::Processor:D $processor --` Nil)>

Adds an end-point object `$processor` to the dispatcher.

Note that the `attach` method of a custom processor is expected to return a [`Promise`](https://docs.raku.org/type/Promise) which is to be kept only and only when the processor is ready. The meaning of being ready would then depend on the end-point type only.

### `multi method add(Log::Dispatch::Processor:U $processor, *%params)`

This method creates an instance of the `$processor` type using `%params` as constructor parameters. The resulting instance is then gets registered with the dispatcher.

### `multi method add(`[`Str`](https://docs.raku.org/type/Str)`:D $processor, *%params)`

This method determines processor type based on the name provided in `$processor` parameter and then instantiates it as described for the previous method candidate.

The following rules are used to resolve the type:

* if it contains a colon pair *::* then the name is used as-is
* otherwise the name is prefixed with *Log::Dispatch::* prefix
* the resulting name is used to load a module of the same name with `require`

See the example in the [Model](#Model) section above.

### `shutdown`

Can only be issued once on a dispatcher. Any subsequent call to the method is ignored.

Closes the dispatching supply by invoking method `done` on the [`Supplier`](https://docs.raku.org/type/Supplier).

The method can be invoked manually when absolutely necessary. But normally is it called inside an `END` phaser to ensure that the logging capabilities are available up until the complete stop of the application.

### `Supply`

Produces a new supply to be tapped upon

### `dispatch-msg(`[`Log::Dispatch::Msg:D`](docs/md/Log/Dispatch/Msg.md)`$msg)`

Emits [`Log::Dispatch::Msg`](docs/md/Log/Dispatch/Msg.md) object into the dispatching supply.

# SEE ALSO

[`Log::Dispatch::File`](docs/md/Log/Dispatch/File.md), [`Log::Dispatch::TTY`](docs/md/Log/Dispatch/TTY.md), [`Log::Dispatch::Types`](docs/md/Log/Dispatch/Types.md), [`Log::Dispatch::Source`](docs/md/Log/Dispatch/Source.md), [`Log::Dispatch::Destination`](docs/md/Log/Dispatch/Destination.md), [`Log::Dispatch::Msg`](docs/md/Log/Dispatch/Msg.md)

# AUTHOR

Vadim Belman [vrurg@cpan.org](mailto:vrurg@cpan.org)

# LICENSE

Atristic 2.0


## dist_zef-raku-community-modules-IO-MiddleMan.md
[![Build Status](https://travis-ci.org/zoffixznet/perl6-IO-MiddleMan.svg)](https://travis-ci.org/zoffixznet/perl6-IO-MiddleMan)

# NAME

IO::MiddleMan - hijack, capture, or mute writes to an IO::Handle

# TABLE OF CONTENTS

* [NAME](#name)
* [SYNOPSIS](#synopsis)
* [DESCRIPTION](#description)
* [ACCESSORS](#accessors)
  * [`.data`](#data)
  * [`.handle`](#handle)
  * [`.mode`](#mode)
* [METHODS](#methods)
  * [`.capture`](#capture)
  * [`.hijack`](#hijack)
  * [`.mute`](#mute)
  * [`.normal`](#normal)
  * [`.Str`](#str)
* [CAVEATS](#caveats)
* [REPOSITORY](#repository)
* [BUGS](#bugs)
* [AUTHOR](#author)
* [LICENSE](#license)

# SYNOPSIS

```
    my $mm = IO::MiddleMan.hijack: $*OUT;
    say "Can't see this yet!";
    $mm.mode = 'normal';
    say "Want to see what I said?";
    say "Well, fine. I said $mm";

    my $fh = 'some-file'.IO.open: :w;
    my $mm = IO::MiddleMan.capture: $fh;
    $fh.say: 'test', 42;
    say "We wrote $mm into some-file";

    IO::MiddleMan.mute: $*ERR;
    note "you'll never see this!";

```

# DESCRIPTION

This module allows you to inject yourself in the middle between an `IO::Handle`
and things writing into it. You can completely hijack the data, merely capture
it, or discard it entirely.

# ACCESSORS

## `.data`

```
    say Currently captured things are " $mm.data.join: '';

    $mm.data = () unless $mm.data.grep: {/secrets/};
    say "Haven't seen any secrets yet. Restarted the capture";

```

An array that contains data captured by [`.hijack`](#hijack) and
[`.capture`](#capture) methods. Each operation on the filehandle add one
element to `.data`; those operations are calls to `.print`, `.print-nl`,
`.say`, and `.put` methods on the original filehandle. Note that `.data`
added with `.say`/`.put` will have `\n` added to it already.

## `.handle`

```
    my $mm = IO::MiddleMan.mute: $*OUT;
    say "This is muted";
    $mm.handle.say: "But this still works!";

```

The original `IO::Handle`. You can still successfully call data methods on it,
and no captures will be done, regardless of what the `IO::MiddleMan`
[`.mode`](#mode) is.

## `.mode`

```
    my $mm = IO::MiddleMan.hijack: $*OUT;
    say "I'm hijacked!";
    $mm.mode = 'normal';
    say "Now things are back to normal";

```

Sets operational mode for the `IO::MiddleMan`. Valid modes are
[`capture`](#capture), [`hijack`](#hijack), [`mute`](#mute), and
[`normal`](#normal). See methods of the corresponding name for the
description of the behavior these modes enable.

# METHODS

## `.capture`

```
    my $mm = IO::MiddleMan.capture: $*OUT;
    say "I'm watching you";

```

Creates and returns a new `IO::MiddleMan` object set to capture all the data
sent to the `IO::Handle` given as the positional argument. Any writes to the
original `IO::Handle` will proceed as normal, while also being stored in
[`.data` accessor](#data).

## `.hijack`

```
    my $mm = IO::MiddleMan.hijack: $*OUT;
    say "Can't see this yet!";

```

Creates and returns a new `IO::MiddleMan` object set to hijack all the data
sent to the `IO::Handle` given as the positional argument. Any writes to the
original `IO::Handle` will NOT reach it and instead will be stored in
[`.data` accessor](#data).

## `.mute`

```
    my $mm = IO::MiddleMan.mute: $*OUT;
    say "You'll never see this!";

```

Creates and returns a new `IO::MiddleMan` object set to ignore all the data
sent to the `IO::Handle` given as the positional argument.

## `.normal`

```
    my $mm = IO::MiddleMan.normal: $*OUT;
    say "Things look perfectly normal";

```

Creates and returns a new `IO::MiddleMan` object set to send all the data
sent to the `IO::Handle` given as the positional argument as it normally would
and no capturing of it is to be done.

## `.Str`

```
    say "Captured $mm";

```

This module overrides the `.Str` method to return all the
[captured data](#data) as a string.

# CAVEATS

The module currently only operates on non-binary data (i.e. `write` method
is still native to `IO::Handle`). Patches are welcome.

The given filehandle must be a writable container and its contents will
be changed to the `IO::MiddleMan` object, thus possibly complicating some
operations.

# REPOSITORY

Fork this module on GitHub:
<https://github.com/raku-community-modules/IO-MiddleMan>

# BUGS

To report bugs or request features, please use
<https://github.com/raku-community-modules/IO-MiddleMan/issues>

# AUTHOR

Zoffix Znet (<http://zoffix.com/>)

# LICENSE

You can use and distribute this module under the terms of the
The Artistic License 2.0. See the `LICENSE` file included in this
distribution for complete details.


## dist_cpan-CTILMES-LibUUID.md
# LibUUID

[![Build Status](https://travis-ci.org/CurtTilmes/perl6-libuuid.svg)](https://travis-ci.org/CurtTilmes/perl6-libuuid)

Perl 6 bindings for [libuuid](https://libuuid.sourceforge.io/).

This library creates Universally Unique IDentifiers (UUID).

The uuid will be generated based on high-quality randomness from
/dev/urandom, if available. If it is not available, then it will use
an alternative algorithm which uses the current time, the local
ethernet MAC address (if available), and random data generated using a
pseudo-random generator.

# Installation

This module depends on [libuuid](https://libuuid.sourceforge.io/), so
it must be installed first.

For Linux ubuntu, try `sudo apt-get install uuid-dev`.

On Mac you can get hold of it via `brew install ossp-uuid`

Then install this module with `zef install LibUUID`.

# Usage

```
use LibUUID;

my $uuid = UUID.new;  # Create a new UUID

$uuid = UUID.new($myblob); # From existing blob of 16 bytes

$uuid = UUID.new('39ed750e-a1bf-4792-81d6-e098f01152d3'); # From Str

say ~$uuid; # Stringify to hex digits with dashes

say $uuid.Blob; # Blobify to Blob of 16 bytes

```

# See Also

[UUID](https://github.com/retupmoca/P6-UUID) is a Perl 6 native UUID
generator which generates UUIDs from Perl's internal random number
generator.

On Linux machines, you can get UUIDs straight from the kernel:

```
cat /proc/sys/kernel/random/uuid

```


## dist_cpan-HANENKAMP-HTTP-Supply.md
# NAME

HTTP::Supply - modern HTTP/1.x message parser

# SYNOPSIS

```
use HTTP::Supply::Request;

react {
    whenever IO::Socket::Async.listen('localhost', 8080) -> $conn {
        my $envs = HTTP::Supply::Request.parse-http($conn);
        whenever $envs -> %env {
            my $res := await app(%env);
            send-response($conn, $res);
        }
    }
}

use HTTP::Supply::Response;

react {
    whenever IO::Socket::Async.connect('localhost', 8080) -> $conn {
        send-request($conn);

        whenever HTTP::Supply::Response.parse-http($conn) -> $res {
            handle-response($res);
            done unless send-request($conn);
        }
    }
}

```

# DESCRIPTION

**EXPERIMENTAL:** The API for these modules is experimental and may change.

This project provides asynchronous parsers for parsing HTTP request or response pipelines. As of this writing only HTTP/1.x is supported, but I hope to add HTTP/2 and HTTP/3 support as time allows.

# AUTHOR

Sterling Hanenkamp `<hanenkamp@cpan.org>`

# COPYRIGHT & LICENSE

Copyright 2016 Sterling Hanenkamp.

This software is licensed under the same terms as Raku.


## dist_zef-tony-o-Encoding-Huffman-PP6.md
# Huffman Encoding in pure perl6

What a joy.

## Subs provided + signatures

### Encoding

`sub huffman-encode(Str $string-to-encode, %table?)`

#### `$string-to-encode`

The string you wish to encode

#### `%table?`

The encoding table you'd like to use. Defaults to the HTTP2 spec's predefined huffman table found [here](https://http2.github.io/http2-spec/compression.html#huffman.code)

### Decoding

`sub huffman-decode(Buf[uint8] $buffer-to-decode, %table?)`

#### `$buffer-to-decode`

A `Buf[uint8]` that you wish to decode

#### `%table?`

Please reference above.


## dist_github-moznion-IO-Blob.md
[![Build Status](https://travis-ci.org/moznion/p6-IO-Blob.svg?branch=master)](https://travis-ci.org/moznion/p6-IO-Blob)

# NAME

IO::Blob - IO:: interface for reading/writing a Blob

# SYNOPSIS

```
use v6;
use IO::Blob;

my $data = "foo\nbar\n";
my IO::Blob $io = IO::Blob.new($data.encode);

$io.get; # => "foo\n"

$io.print('buz');

$io.seek(0); # rewind

$io.slurp-rest; # => "foo\nbar\nbuz"

```

# DESCRIPTION

`IO::` interface for reading/writing a Blob. This class inherited from IO::Handle.

The IO::Blob class implements objects which behave just like IO::Handle objects, except that you may use them to write to (or read from) Blobs.

This module is inspired by IO::Scalar of perl5.

# METHODS

## new(Blob $data = Buf.new)

Make a instance. This method is equivalent to `open`.

```
my $io = IO::Blob.new("foo\nbar\n".encode);

```

## open(Blob $data = Buf.new)

Make a instance. This method is equivalent to `new`.

```
my $io = IO::Blob.open("foo\nbar\n".encode);

```

## new(Str $str)

Make a instance. This method is equivalent to `open`.

```
my $io = IO::Blob.new("foo\nbar\n");

```

## open(Str $str)

Make a instance. This method is equivalent to `new`.

```
my $io = IO::Blob.open("foo\nbar\n");

```

## get(IO::Blob:D:)

Reads a single line from the Blob.

```
my $io = IO::Blob.open("foo\nbar\n".encode);
$io.get; # => "foo\n"

```

## getc(IO::Blob:D:)

Read a single character from the Blob.

```
my $io = IO::Blob.open("foo\nbar\n".encode);
$io.getc; # => "f\n"

```

## lines(IO::Blob:D: $limit = Inf)

Return a lazy list of the Blob's lines read via `get`, limited to `$limit` lines.

```
my $io = IO::Blob.open("foo\nbar\n".encode);
for $io.lines -> $line {
    $line; # 1st: "foo\n", 2nd: "bar\n"
}

```

## word(IO::Blob:D:)

Read a single word (separated on whitespace) from the Blob.

```
my $io = IO::Blob.open("foo bar\tbuz\nqux".encode);
$io.word; # => "foo "

```

## words(IO::Blob:D: $count = Inf)

Return a lazy list of the Blob's words (separated on whitespace) read via `word`, limited to `$count` words.

```
my $io = IO::Blob.open("foo bar\tbuz\nqux".encode);
for $io.words -> $word {
    $word; # 1st: "foo ", 2nd: "bar\t", 3rd: "buz\n", 4th: "qux"
}

```

## print(IO::Blob:D: \*@text) returns Bool

Text writing; writes the given `@text` to the Blob.

## say(IO::Blob:D: \*@text) returns Bool

Text writing; similar to print, but add a newline to end of the `@text`.

## read(IO::Blob:D: Int(Cool:D) $bytes)

Binary reading; reads and returns `$bytes` bytes from the Blob.

## write(IO::Blob:D: Blob:D $buf)

Binary writing; writes $buf to the Blob.

## seek(IO::Blob:D: int $offset, SeekType:D $whence = SeekFromBeginning)

Move the pointer (that is the position at which any subsequent read or write operations will begin,) to the byte position specified by `$offset` relative to the location specified by `$whence` which may be one of:

* SeekFromBeginning

The beginning of the file.

* SeekFromCurrent

The current position in the file.

* SeekFromEnd

The end of the file.

## tell(IO::Blob:D:) returns Int

Returns the current position of the pointer in bytes.

## ins(IO::Blob:D:) returns Int

Returns the number of lines read from the file.

## slurp-rest(IO::Blob:D: :$bin!) returns Buf

Return the remaining content of the Blob from the current position (which may have been set by previous reads or by seek.) If the adverb `:bin` is provided a Buf will be returned.

## slurp-rest(IO::Blob:D: :$enc = 'utf8') returns Str

Return the remaining content of the Blob from the current position (which may have been set by previous reads or by seek.) Return will be a Str with the optional encoding `:enc`.

## eof(IO::Blob:D:)

Returns Bool::True if the read operations have exhausted the content of the Blob;

## close(IO::Blob:D:)

Will close a previously opened Blob.

## is-closed(IO::Blob:D:)

Returns Bool::True if the Blob is closed.

## data(IO::Blob:D:)

Returns the current Blob.

# SEE ALSO

[IO::Scalar of perl5](https://metacpan.org/pod/IO::Scalar)

# AUTHOR

moznion [moznion@gmail.com](mailto:moznion@gmail.com)

# CONTRIBUTORS

* mattn
* shoichikaji

# LICENSE

Copyright 2015 moznion [moznion@gmail.com](mailto:moznion@gmail.com)

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.


## dist_cpan-RBT-File-Temp.md
[![Build status](https://ci.appveyor.com/api/projects/status/github/perlpilot/p6-File-Temps?svg=true)](https://ci.appveyor.com/project/perlpilot/p6-File-Temps/branch/master)

# NAME

File::Temp

# SYNOPSIS

```
# Generate a temp file in a temp dir
my ($filename,$filehandle) = tempfile;

# specify a template for the filename
#  * are replaced with random characters
my ($filename,$filehandle) = tempfile("******");

# Automatically unlink files at DESTROY (this is the default)
my ($filename,$filehandle) = tempfile("******", :unlink);

# Specify the directory where the tempfile will be created
my ($filename,$filehandle) = tempfile(:tempdir("/path/to/my/dir"));

# don't unlink this one
my ($filename,$filehandle) = tempfile(:tempdir('.'), :!unlink);

# specify a prefix and suffix for the filename
my ($filename,$filehandle) = tempfile(:prefix('foo'), :suffix(".txt"));

```

# DESCRIPTION

This module exports two routines:

* `tempfile` creates a temporary file and returns a filehandle to that file
  opened for writing and the filename of that temporary file
* `tempdir` creates a temporary directory and returns the directory name.

# AUTHOR

Jonathan Scott Duff [duff@pobox.com](mailto:duff@pobox.com)


## dist_zef-dwarring-LWP-Simple.md
# LWP::Simple for Raku

![Test Windows and MacOS](https://github.com/raku-community-modules/LWP-Simple/workflows/Test%20Windows%20and%20MacOS/badge.svg)

This is a quick & dirty implementation of a LWP::Simple clone for Raku; it does both `GET` and `POST` requests.

# Dependencies

LWP::Simple depends on the modules MIME::Base64 and URI,
which you can find at <http://modules.raku.org/>. The tests depends
on [JSON::Tiny](https://github.com/moritz/json).

Write:

```
zef install --deps-only .

```

You'll have to
install [IO::Socket::SSL](https://github.com/sergot/io-socket-ssl) via

```
zef install IO::Socket::SSL

```

if you want to work with `https` too.

# Synopsis

```
use LWP::Simple;

my $content = LWP::Simple.get("https://raku.org");

my $response = LWP::Simple.post("https://somewhere.topo.st", { so => True }

```

# Methods

## get ( $url, [ %headers = {}, Bool :$exception ] )

Sends a GET request to the value of `$url`. Returns the content of the return
request. Errors are ignored and will result in a `Nil` value unless
`$exception` is set to `True`, in which case an `LWP::Simple::Response` object
containing the status code and brief description of the error will be returned.

Requests are make with a default user agent of `LWP::Simple/$VERSION Raku/$*PERL.compiler.name()` which may get blocked by some web servers. Try
overriding the default user agent header by passing a user agent string to the
`%headers` argument with something like `{ 'User-Agent' => 'Your User-Agent String' }` if you have trouble getting content back.

# Current status

You can
use [HTTP::UserAgent](https://github.com/sergot/http-useragent)
instead, with more options. However, this module will do just fine in
most cases.

The documentation of this module is incomplete. Contributions are appreciated.

# Use

Use the installed commands:

```
 lwp-download.p6  http://eu.httpbin.org

```

Or

```
 lwp-download.p6  https://docs.perl6.org

```

If `ÌO::Socket::SSL` has been installed.

```
lwp-get.p6  https://raku.org

```

will instead print to standard output.

# Known bugs

According
to
[issues raised](https://github.com/raku-community-modules/LWP-Simple/issues/40),
[in this repo](https://github.com/raku-community-modules/LWP-Simple/issues/28),
there could be some issues with older versions of MacOSx. This issue
does not affect the functionality of the module, but just the test
script itself, so you can safely install with `--force`. Right now,
it's working correctly (as far as tests go) with Windows, MacOSx and
Linux.

# License

This distribution is licensed under the terms of
the
[Artistic 2.0 license](https://www.perlfoundation.org/artistic-license-20.html). You
can find a [copy](LICENSE) in the repository itself.


## dist_zef-thundergnat-Text-Sorensen.md
[![Actions Status](https://github.com/thundergnat/Text-Sorensen/actions/workflows/test.yml/badge.svg)](https://github.com/thundergnat/Text-Sorensen/actions)

# NAME Text::Sorensen

Calculate the Sorensen-Dice or Jaccard similarity coefficient.

# SYNOPSIS

```
use Text::Sorensen :sorensen;

# test a word against a small list
say sorensen('compition', 'completion', 'competition');

# ([0.777778 competition] [0.705882 completion])

# or against a large one
my %hash = './unixdict.txt'.IO.slurp.words.race.map: { $_ => .&bi-gram };

.say for sorensen('compition', %hash).head(5);
# [0.777778 competition]
# [0.777778 compilation]
# [0.777778 composition]
# [0.705882 completion]
# [0.7 decomposition]

use Text::Sorensen :jaccard;

.say for jaccard('compition', %hash).head(5);
# [0.636364 competition]
# [0.636364 compilation]
# [0.636364 composition]
# [0.545455 completion]
# [0.538462 decomposition]

```

# DESCRIPTION

Both Sorensen-Dice and Jaccard calculate a "similarity" between two tokenized groups of items. They can be used to compare many different types of tokenized objects; this module is optimized to do a text similarity calculation.

Both methods use a similar algorithm and, though they assign different weights, return nearly identical relative coefficients, and may be readily converted from one to the other.

You can easily convert back and forth:

```
# JI   (Jaccard index)
# SDI (Sorensen-Dice index)

JI = SDI / (2 - SDI)

SDI = 2 * JI / (1 + JI)

```

For both operations, each word / phrase is broken up into tokens for the comparison. The most typical tokenizing scheme for text is to break the words up into bi-grams: groups of two consecutive letters. For instance, the word 'differ' would be tokenized to the group:

```
'di', 'if', 'ff', 'fe', 'er'

```

This tokenized word is then compared to another tokenized word to calculate the similarity.

The bi-gram routine case-folds the words before tokenizing so the comparison routines ignore case differences.

A great deal of the work is spent in tokenizing the words. If you plan to do multiple comparisons to a large group of words, it may be worthwhile to pre-tokenize the word list to reduce the working time.

When using the module, you must specify which similarity routine(s) you want to import. There are the two basic similarity algorithms and several built-in, exported-on-demand aliases available.

Optionally exported similarity routines:

```
:sorensen  --> sub sorensen() # traditional spelling
:sorenson  --> sub sorenson() # alternate spelling
:sdi       --> sub sdi()      # Sorensen-Dice index
:dice      --> sub dice()     # let Dice have top billing for once
:dsc       --> sub dsc()      # Dice similarity coefficient
# All point to exactly the same routines behind the scenes.

:jaccard   --> sub jaccard()  # Jaccard index

```

You'll need to import at least one similarity routine, or some combination, or :ALL.

Always exported helper routine:

```
C<sub bi-gram()> # tokenize a word into a Bag of bi-grams

```

### Sorensen-Dice

```
use Text::Sorensen :sorensen; # or some other alias

```

Sorensen-Dice, named after botanists Thorvald Sørensen and Lee Raymond Dice, measures the similarity of two groups by dividing twice the intersection token count by the total token count of both groups.

```
2 * +(@a ∩ @b) / (@a ⊎ @b)

```

The index is known by several names, Sorensen-Dice index is probably most common, though Sorensen index and Dice's coefficient are also popular. Other variations include the "similarity coefficient" or "index", such as Dice similarity coefficient (DSC).

The module provides multi subs for different use cases.

For a one-off or low memory case, use:

```
sorensen($word, @list, :$ge)

```

Where $word is the word to be compared against, @list is a list or array of words to compare with $word, and :$ge is the minimum for the returned coefficients (default .5). (It's the coefficients **greater than or equal to** .5).

The list of words will be tokenized, the coefficient calculated, entries with coefficients lower than the :$ge threshold filtered out and the remaining list sorted and returned. If you want all values to be returned, even ones that don't match at all, you'll need to specify :ge(0). It's a little unintuitive at first but can seriously reduce memory and time consumption for the common use case.

Each word comparison will return a 2 element array consisting of:

* the SDC from the :ge threshold (default .5) to 1 (identical).
* the word that was checked.

That works well but retokenizes the list every time it is invoked.

If you want to reuse a list several times to check against mutiple words, it may be better to pre-tokenize the list and pass that to the coefficient function.

Use the module supplied, always exported, sub bi-gram() on each element to pre-tokenize the list.

```
# returns the tokenized word as a Bag
my $tokens = bi-gram($word);

```

Save the list as a hash of word / tokens pairs, then pass that into the coefficient function to avoid re-tokenizing every time. This is a nice parallelizable operation so .race can really speed it up.

```
my %hash = './unixdict.txt'.IO.slurp.words.race.map: { $_ => .&bi-gram };

sorensen($word, %hash)

```

The returned list has results less than the :ge threshold filtered out and is sorted by inverse coefficient (largest first) with a secondary alphabetical sort.

See the following. We compare the typo 'compition' against an entire dictionary, filter out everything lower than .6 coefficient and return the sorted list.

```
.say for sorensen('compition', %hash, :ge(.6));
# [0.777778 competition]
# [0.777778 compilation]
# [0.777778 composition]
# [0.705882 completion]
# [0.7 decomposition]
# [0.666667 compunction]
# [0.666667 computation]

```

### Jaccard

```
use Text::Sorensen :jaccard;

```

The Jaccard index (named for botanist Paul Jaccard) is calculated very similarly to the Sorensen-Dice index.

Instead of the intersection token count divided by the total token count, it is the intersection token count divided by the difference between the total token count and the intersection token count. (Intersection over difference rather than intersection over sum).

```
+(@a ∩ @b) / ( (@a ⊎ @b) - (@a ∩ @b) )

```

Jaccard coefficients tend to be even smaller than Sorensen-Dice but are similarly, a ratio between 0 and 1.

Again, multis are provided for a one-off list:

```
my @results = jaccard($word, @list, :$ge);

```

or a multi use hash.

```
my @results =  jaccard($word, @hash, :$ge);

```

The exact same tokenizer is used for each, and the same efficiencies come into play by pre-tokenizing dictionaries for repeated use.

```
.say for jaccard('maintainence', %hash, :ge(.45));
# [0.636364 maintain]
# [0.615385 maintenance]

```

# AUTHOR

2019 Steve Schulze aka thundergnat

This package is free software and is provided "as is" without express or implied warranty. You can redistribute it and/or modify it under the same terms as Perl itself.

# LICENSE

Licensed under The Artistic 2.0; see LICENSE.


## dist_zef-slid1amo2n3e4-mv2d.md
Fork of <https://github.com/raku-community-modules/App-MoarVM-Debug>

## Usage

Start the debugger:

```
$ mv2d main.raku

```

Set a breakpoint on line 42:

```
> bp main.raku 42

```

Then type resume to resume the thread to hit it:

```
> resume

```

Type `help` to see all of the commands.

## Known Issues

The only stepping mode currently available is Step Into.

Backtraces will show incorrect line numbers.

Source can be located at: <https://github.com/slid1amo2n3e4/mv2d>. Comments and Pull Requests are welcome.

# COPYRIGHT AND LICENSE

Copyright 2017 - 2020 Edument AB

Copyright 2024 The Raku Community

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.


## definitehow.md
class Metamodel::DefiniteHOW

Metaobject for type definiteness

```raku
    class Metamodel::DefiniteHOW
        does Metamodel::Documenting
            { }

```

*Warning*: this class is part of the Rakudo implementation, and is not a part of the language specification.

Type objects may be given a *type smiley*, which is a suffix that denotes their definiteness:

```raku
say Any:D.^name; # OUTPUT: «Any:D␤»
say Any:U.^name; # OUTPUT: «Any:U␤»
say Any:_.^name; # OUTPUT: «Any␤»

```

Despite sharing a type with [`Any`](/type/Any), `Any:U` and `Any:D` in particular have different type-checking behaviors from it:

```raku
say Any ~~ Any:D;     # OUTPUT: «False␤»
say Any ~~ Any:U;     # OUTPUT: «True␤»
say Any ~~ Any:_;     # OUTPUT: «True␤»
say Any.new ~~ Any:D; # OUTPUT: «True␤»
say Any.new ~~ Any:U; # OUTPUT: «False␤»
say Any.new ~~ Any:_; # OUTPUT: «True␤»

```

This happens because `Any:D` and `Any:U` are not created with [`Metamodel::ClassHOW`](/type/Metamodel/ClassHOW) like you might expect [`Any`](/type/Any) type objects to be, but `Metamodel::DefiniteHOW` instead. This HOW defines the behavior for definite type objects such as these.

The following type declaration:

```raku
my Any constant Definite = Any:D;

```

Is roughly equivalent to this code using the methods of `Metamodel::DefiniteHOW`:

```raku
my Any constant Definite = Metamodel::DefiniteHOW.new_type: base_type => Any, definite => 1;

```

# [Methods](#class_Metamodel::DefiniteHOW "go to top of document")[§](#Methods "direct link")

## [method new\_type](#class_Metamodel::DefiniteHOW "go to top of document")[§](#method_new_type "direct link")

```raku
method new_type(:$base_type!, :$definite!)
```

Creates a new definite type given a base type and definiteness. `$definite` should either be `1` for `:D` types or `0` for `:U` types.

## [method name](#class_Metamodel::DefiniteHOW "go to top of document")[§](#method_name "direct link")

```raku
method name($definite_type)
```

Returns the name of a definite type.

## [method shortname](#class_Metamodel::DefiniteHOW "go to top of document")[§](#method_shortname "direct link")

```raku
method shortname($definite_type)
```

Returns the shortname of a definite type.

## [method base\_type](#class_Metamodel::DefiniteHOW "go to top of document")[§](#method_base_type "direct link")

```raku
method base_type($definite_type)
```

Returns the base type for a definite type:

```raku
say Any:D.^base_type.^name; # OUTPUT: «Any␤»

```

## [method definite](#class_Metamodel::DefiniteHOW "go to top of document")[§](#method_definite "direct link")

```raku
method definite($definite_type)
```

Returns `1` if the definite type given is a `:D` type or `0` if it is a `:U` type.

## [method nominalize](#class_Metamodel::DefiniteHOW "go to top of document")[§](#method_nominalize "direct link")

```raku
method nominalize($obj)
```

Produces a nominal type object for a definite type. This is its base type, which may also get nominalized if it has the `nominalizable` archetype.

## [method find\_method](#class_Metamodel::DefiniteHOW "go to top of document")[§](#method_find_method "direct link")

```raku
method find_method($definite_type, $name)
```

Looks up a method on the base type of a definite type.

## [method type\_check](#class_Metamodel::DefiniteHOW "go to top of document")[§](#method_type_check "direct link")

```raku
method type_check($definite_type, $checkee)
```

Performs a type-check of a definite type against `$checkee`. This will check if `$checkee` is of its base type, returning `True` if they match or `False` otherwise. This metamethod can get called when a definite type is on the left-hand side of a smartmatch, for instance.

## [method accepts\_type](#class_Metamodel::DefiniteHOW "go to top of document")[§](#method_accepts_type "direct link")

```raku
method accepts_type($definite_type, $checkee)
```

Performs a type-check of `$checkee` against a definite type. This will check if `$checkee` is of its base type and matches its definiteness, returning `True` if they match or `False` otherwise. This metamethod can get called when the definite type is on the right-hand side of a smartmatch, for instance.


## dist_zef-raku-community-modules-Grammar-Profiler-Simple.md
[![Actions Status](https://github.com/raku-community-modules/Grammar-Profiler-Simple/actions/workflows/test.yml/badge.svg)](https://github.com/raku-community-modules/Grammar-Profiler-Simple/actions)

# NAME

Grammar::Profiler::Simple - Simple rule profiling for Raku grammars

# SYNOPSIS

```
use Grammar::Profiler::Simple;

my grammar MyGrammar {
    rule MyRule {
        ...
    }
}

reset-timing;
MyGrammar.new.parse($string);

say "MyRule was called &get-timing(MyGrammar,MyRule)<calls> times";
say "The total time executing MyRule was &get-timing(MyGrammar,MyRule)<time> seconds";

```

# DESCRIPTION

This module provides a simple profiler for Raku grammars. To enable profiling simply add

```
use Grammar::Profiler::Simple;

```

to your code. Any grammar in the lexical scope of the `use` statement will automatically have profiling information collected when the grammar is used.

There are 2 bits of timing information collected: the number of times each rule was called and the cumulative time that was spent executing each rule. For example:

say "MyRule was called &get-timing(MyGrammar,MyRule)} times"; say "The total time executing MyRule was &get-timing(MyGrammar,MyRule)} seconds";

# EXPORTED SUBROUTINES

## reset-timing

Reset all time information collected since the start of the program or since the last call to `reset-timing` for all grammars, or for the specified grammar only (and all its rules), or for the specified grammar and rule only.

```
reset-timing;                     # all grammars and rules

reset-timing(MyGrammar);          # MyGrammar only

reset-timing(MyGrammar, MyRule);  # MyRule in MyGrammar only

```

## get-timing

Either returns all time information collected since the start of the program or since the last call to `reset-timing` for all grammars, or for the specified grammar only (and all its rules), or for the specified grammar and rule only. What is returned is always a `Hash`.

```
my %t := get-timing;                       # %<grammar><rules><calls|time>

my %tg := get-timing(MyGrammar);           # %<rules><calls|time>

my %tgr := get-timing(MyGrammar, MyRule);  # %<calls|time>

```

# AUTHOR

Jonathan Scott Duff

# COPYRIGHT AND LICENSE

Copyright 2011 - 2017 Jonathan Scott Duff

Copyright 2018 - 2022 Raku Community

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.


## raceseq.md
class RaceSeq

Performs batches of work in parallel without respecting original order.

```raku
class RaceSeq does Iterable does Sequence { }
```

A `RaceSeq` is the intermediate object used when [`race`](/routine/race) is invoked on a [`Seq`](/type/Seq). In general, it's not intended for direct consumption by the developer.

# [Methods](#class_RaceSeq "go to top of document")[§](#Methods "direct link")

## [method iterator](#class_RaceSeq "go to top of document")[§](#method_iterator "direct link")

```raku
method iterator(RaceSeq:D: --> Iterator:D)
```

Returns the underlying iterator.

## [method grep](#class_RaceSeq "go to top of document")[§](#method_grep "direct link")

```raku
method grep(RaceSeq:D: $matcher, *%options)
```

Applies `grep` to the `RaceSeq` similarly to how it would do it on a [`Seq`](/type/Seq).

```raku
my @raced = (^10000).map(*²).race;
@raced.grep( * %% 3 ).say;
# OUTPUT: «(0 9 36 81 144 ...)␤»

```

When you use `race` on a [`Seq`](/type/Seq), this is the method that is actually called.

## [method map](#class_RaceSeq "go to top of document")[§](#method_map "direct link")

```raku
method map(RaceSeq:D: $matcher, *%options)
```

Uses maps on the `RaceSeq`, generally created by application of `.race` to a preexisting [`Seq`](/type/Seq).

## [method invert](#class_RaceSeq "go to top of document")[§](#method_invert "direct link")

```raku
method invert(RaceSeq:D:)
```

Inverts the `RaceSeq` created from a [`Seq`](/type/Seq) by `.race`.

## [method race](#class_RaceSeq "go to top of document")[§](#method_race "direct link")

```raku
method race(RaceSeq:D:)
```

Returns the object.

## [method hyper](#class_RaceSeq "go to top of document")[§](#method_hyper "direct link")

```raku
method hyper(RaceSeq:D:)
```

Creates a [`HyperSeq`](/type/HyperSeq) object out of the current one.

## [method serial](#class_RaceSeq "go to top of document")[§](#method_serial "direct link")

```raku
multi method serial(RaceSeq:D:)
```

Converts the object to a [`Seq`](/type/Seq) and returns it.

## [method is-lazy](#class_RaceSeq "go to top of document")[§](#method_is-lazy "direct link")

```raku
method is-lazy(--> False )
```

Returns `False`.

## [method sink](#class_RaceSeq "go to top of document")[§](#method_sink "direct link")

```raku
method sink(--> Nil)
```

Sinks the underlying data structure, producing any side effects.

# [Typegraph](# "go to top of document")[§](#typegraphrelations "direct link")

Type relations for `RaceSeq`

raku-type-graph

RaceSeq
RaceSeq

Any
Any

RaceSeq->Any

Iterable
Iterable

RaceSeq->Iterable

Sequence
Sequence

RaceSeq->Sequence

Mu
Mu

Any->Mu

PositionalBindFailover
PositionalBindFailover

Sequence->PositionalBindFailover

[Expand chart above](/assets/typegraphs/RaceSeq.svg)


## dist_zef-FCO-ValueClass.md
[![Actions Status](https://github.com/FCO/ValueClass/actions/workflows/test.yml/badge.svg)](https://github.com/FCO/ValueClass/actions)

# NAME

ValueClass - A way to create immutable value objects

# SYNOPSIS

```
use ValueClass;

value-class Bla {
    has $.a = 42;
    has @.b;
    has %.c;

    method TWEAK() {
        %!c := ValueMap.new: (a => 1)
    }
}

say Bla.new: :b[1,2,3];
# Bla.new(a => 42, b => Tuple.new(1, 2, 3), c => ValueMap.new((:a(1))))

```

# DESCRIPTION

ValueClass creates immutable objects.

If you are only worried about other people mutating your objects, you may take a look at [ValueType](https://raku.land/zef:lizmat/ValueType). But if you want to avoid letting even yourself, on your internal methods, mutate your objects, you will probably need something like this module.

Classes created using the value-class keyword will create objects that will die whenever anyone try to mutate them. It will also die when the object is created with any attribute that's not a value type.

The object will become immutable just after TWEAK. So TWEAK is your last chance to mutate your objects.

(It does not allow default values for `@` and `%` sigled attributes. You will need to use `TWEAK` to populate them)

ValueType will change the default type for a attribute using the @ to Tuple and the % to ValueMap to make it possible to use Positionals and Associative on ValueClass.

# AUTHOR

Fernando Corrêa de Oliveira [fco@cpan.org](mailto:fco@cpan.org)

# COPYRIGHT AND LICENSE

Copyright 2024 Fernando Corrêa de Oliveira

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.


## dist_zef-jjmerelo-Math-ConvergenceMethods.md
# Math-ConvergenceMethods [Test-install distro](https://github.com/JJ/Math-ConvergenceMethods/actions/workflows/test.yaml)

## Methods

1. Bisection [+info](https://en.wikipedia.org/wiki/Bisection_method)
2. *Regula falsi* [+info](https://en.wikipedia.org/wiki/False_position_method)
3. Secant [+info](https://en.wikipedia.org/wiki/Secant_method)
4. Newton-Rahpson [+info](https://en.wikipedia.org/wiki/Newton%27s_method)
5. Fixed-point iteration
   [+info](https://en.wikipedia.org/wiki/Fixed-point_iteration). This method
   returns the fixed point if it's found in the interval, not the zero of
   the function.
6. Steffensen [+info](https://en.wikipedia.org/wiki/Steffensen%27s_method)

## Stop conditions

This modules uses three different stopping conditions.

1. Difference between two successive approximations
2. Relative difference between two successive approximations
3. Residue

## LICENSE

(c) 2019 [Antonio Gámiz](https://github.com/antoniogamiz), 2022 [JJ Merelo](https://github.com/JJ).

This has been releases under the GPL-3.0 license.


## dist_zef-jonathanstowe-Device-Velleman-K8055.md
# Device::Velleman::K8055

![Build Status](https://github.com/jonathanstowe/Device-Velleman-K8055/workflows/CI/badge.svg)

A Raku interface to the [Velleman USB Experiment Kit](http://www.velleman.eu/products/view/?lang=en&id=351346).

## Synopsis

```
use Device::Velleman::K8055;

my $device = Device::Velleman::K8055.new(address => 0);

react {
    whenever Supply.interval(0.5) -> $i {
        if $i %% 2 {
            $device.set-all-digital(0b10101010);
        }
        else {
            $device.set-all-digital(0b01010101);
        }
    }
    whenever signal(SIGINT) {
        $device.close(:reset);
        exit;
    }
}

```

See also the <examples> directory in the distribution.

## Description

The Velleman K8055 is an inexpensive PIC based board that allows
you to control 8 digital and 2 analogue outputs and read five digital
and 2 analog inputs via USB. There are LEDs on the outputs that
show the state of the outputs (which is largely how I've tested this.)

I guess it would be useful for experimenting or prototyping but it's
rather big (about three times as large as a Raspberry Pi) so you
may be rather constrained if you want to use it in a project.

This module has a fairly simple interface - I guess that a higher
level abstraction could be provided but I only made it as an
experiment and am not quite sure what interface would be best
yet.

I've used the [k8055 library by Jakob Odersky](https://github.com/jodersky/k8055)
to do the low-level parts rather than binding libusb directly, but
all the information is there is someone else wants to do that.

## Install

You will need the development package of `libusb` in order to
build this, this should be available through your system's
package manager as `libusb-devel` or `libusb-dev` (if
you are running a Linux.) At minimum it will require the 'usb.h'
and the required library to link to in places where the C compiler
can find them.

On a system that uses `udev` (most probably Linux,) you will
need to make some configuration changes in order to be able to
use it as a non-privileged user. You will need to perform these
changes with root privileges.

Firstly copy the [k8055.rules](config/k8055.rules) file to the
udev rules directory (`/etc/udev/rules.d` on a typical
installation,)

```
cp config/k8055.rules /etc/udev/rules.d

```

Then create a new group called `k8055`:

```
groupadd -r k8055

```

Finally add yourself (or other users that require access to the
device,) to the new group:

```
usermod -a -G k8055 $(USER)

```

Where $(USER) is the user name of the user that want access.
The access changes won't be available until the device is
next plugged in and the user logs in again.

If the above steps haven't been done before trying to install
the module, it will attempt to skip most of the tests and
may even succeed in installing but may not work well.

If you have a working Rakudo installation you should be able to install with `zef` :

```
zef install Device::Velleman::K8055

```

Other installers may be available in the future.

## Support

This is largely experimental and might prove fiddly to install
so I won't be entirely surprised if you have problems with it,
if however you have any suggestions, feedback or improvements
than please post them on [Github](https://github.com/jonathanstowe/Device-Velleman-K8055-Native/issues)
or even better send a pull request.

## Copyright & Licence

This is free software, see the <LICENCE> file in the
distrubution.

© Jonathan Stowe 2016 - 2019

The terms of the k8055 library used are described in its
[README](https://github.com/jodersky/k8055/blob/master/README.md).


## dist_cpan-FRITH-Math-Libgsl-Elementary.md
[![Build Status](https://travis-ci.org/frithnanth/raku-Math-Libgsl-Elementary.svg?branch=master)](https://travis-ci.org/frithnanth/raku-Math-Libgsl-Elementary)

# NAME

Math::Libgsl::Elementary - An interface to libgsl, the Gnu Scientific Library - elementary functions.

# SYNOPSIS

```
use Math::Libgsl::Elementary :ALL;

```

# DESCRIPTION

Math::Libgsl::Elementary provides an interface to the Elementary Functions in the libgsl, the GNU Scientific Library.

This package provides both the low-level interface to the C library (Raw) and a more comfortable interface layer for the Raku programmer.

Math::Libgsl::Elementary makes these tags available:

* :elem
* :smallint

### sub log1p(Num() $x --> Num) is export(:elem)

Computes the value of log(1 + x).

### sub expm1(Num() $x --> Num) is export(:elem)

Computes the value of exp(x) - 1.

### sub hypot(Num() $x, Num() $y --> Num) is export(:elem)

Computes the value of sqrt(x² + y²).

### sub hypot3(Num() $x, Num() $y, Num() $z --> Num) is export(:elem)

Computes the value of sqrt(x² + y² + z²).

### sub ldexp(Num() $x, Int $e --> Num) is export(:elem)

Computes the value of x \* 2ᵉ.

### sub frexp(Num() $x --> List) is export(:elem)

Computes the value of f such that x = f \* 2ᵉ. It returns a list of two values: f and e.

### sub int-pow(Num() $x, Int $e --> Num) is export(:smallint)

Computes the value of xᵉ with e ∈ ℤ.

### sub uint-pow(Num() $x, UInt $e --> Num) is export(:smallint)

Computes the value of xᵉ with e ∈ ℕ.

### sub pow2(Num() $x --> Num) is export(:smallint)

Computes the value of x².

### sub pow3(Num() $x --> Num) is export(:smallint)

Computes the value of x³.

### sub pow4(Num() $x --> Num) is export(:smallint)

Computes the value of x⁴.

### sub pow5(Num() $x --> Num) is export(:smallint)

Computes the value of x⁵.

### sub pow6(Num() $x --> Num) is export(:smallint)

Computes the value of x⁶.

### sub pow7(Num() $x --> Num) is export(:smallint)

Computes the value of x⁷.

### sub pow8(Num() $x --> Num) is export(:smallint)

Computes the value of x⁸.

### sub pow9(Num() $x --> Num) is export(:smallint)

Computes the value of x⁹.

# C Library Documentation

For more details on libgsl see <https://www.gnu.org/software/gsl/>. The excellent C Library manual is available here <https://www.gnu.org/software/gsl/doc/html/index.html>, or here <https://www.gnu.org/software/gsl/doc/latex/gsl-ref.pdf> in PDF format.

# Prerequisites

This module requires the libgsl library to be installed. Please follow the instructions below based on your platform:

## Debian Linux and Ubuntu 20.04

```
sudo apt install libgsl23 libgsl-dev libgslcblas0

```

That command will install libgslcblas0 as well, since it's used by the GSL.

## Ubuntu 18.04

libgsl23 and libgslcblas0 have a missing symbol on Ubuntu 18.04. I solved the issue installing the Debian Buster version of those three libraries:

* <http://http.us.debian.org/debian/pool/main/g/gsl/libgslcblas0_2.5+dfsg-6_amd64.deb>
* <http://http.us.debian.org/debian/pool/main/g/gsl/libgsl23_2.5+dfsg-6_amd64.deb>
* <http://http.us.debian.org/debian/pool/main/g/gsl/libgsl-dev_2.5+dfsg-6_amd64.deb>

# Installation

To install it using zef (a module management tool):

```
$ zef install Math::Libgsl::Elementary

```

# AUTHOR

Fernando Santagata [nando.santagata@gmail.com](mailto:nando.santagata@gmail.com)

# COPYRIGHT AND LICENSE

Copyright 2020 Fernando Santagata

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.


## dist_cpan-RBT-DBIish-Transaction.md
# DBIish::Transaction

```
use DBIish::Transaction;
use DBIish::Savepoint;

my $t = DBIish::Transaction.new(connection => {DBIish.connect('Pg', :$database);}, :retry);

$t.in-transaction: -> $dbh {
    # BEGIN issued at start

    $dbh.do(q{CREATE TABLE tab (col integer)});

    my $sth = $dbh.prepare('INSERT INTO tab VALUES ($1);');
    $sth.execute(1);

    # Also allows for savepoints on databases supporting this behaviour.
    # These are kinda like sub-transactions. Catch the exception to prevent the
    # outer transaction from being rolled back.
    try {
        my $sp = DBIish::Savepoint.new(connection => $dbh);
        $sp.in-savepoint: -> $sp-dbh {
            # SAVEPOINT issued at start

            my $updsth = $sp-dbh.prepare('UPDATE tab SET col = col + 1');
            $updsth.execute();

            $sth.execute('Insert Invalid Value');

            # ROLLBACK TO <savepoint> issued due to the above failure.
        }
    }

    # COMMIT issued at end
    # Table "tab" contains a single record with col = 1
}

$t.in-transaction: -> $dbh {
    my $sth = $dbh.prepare('INSERT INTO t VALUES ($1);');
    $sth.execute(2);

    fail('Changed my mind about the insert');

    # ROLLBACK due to the error
}

```

## Description

This is a easy to use way of creating database transactions that always commit/rollback and can retry on temporary
failures such as disconnect, deadlocks, serialization issues, or snapshot age.

## DBIish::Transaction

```
DBIish::Transaction.new(:connection, :retry, :max-retry-count, :begin, :rollback, :after-rollback, :commit);

```

### :connection

Either a DBDish::Connection, or a Callable which returns a DBDish::Connection. If a Callable is provided transactions
may be retried if disconnect occurs when :retry is specified. A connection provided by a callable will be disposed of after
completion (commit or rollback) of the transaction. It may also be disposed of and a new connection obtained during
retry to resolve some error types.

This is an example of a transaction using a connection pooler for higher performance, the automatic ability to retry on
network issues, and an upper limit on simultaneous connections. It is recommended for any programs with concurrancy or
on spotty networks.

```
use DBIish::Transaction;
use DBIish::Pool;
my $pool = DBIish::Pool.new(driver => 'Pg', :$database ,:max-connections(20));

my $t = DBIish::Transaction.new(connection => {$pool.get-connection()}, :retry);

```

A connection created outside `DBIish::Transaction` can can retry when the database gives a temporary failure such
as a serialization error, but not when there are network issues.

```
use DBIish::Transaction;
use DBIish;
my $dbh = DBIish.connect('Pg', :$database);

my $t = DBIish::Transaction.new(connection => $dbh, :retry);

```

### :begin($dbh)

```
{  $_.do(q{BEGIN})  }

```

By default this is a Callable which performs the simplest begin statement. You may want to modify transaction behaviour.
Serializable Isolation level is highly recommended on supported products as this mode eliminates many potential
errors due to otherwise silent race conditions.

In the below example using `SERIALIZABLE` and `:retry`, the transaction will be attempted up to 4 times during
serialization errors. This allows safe Raku read/modify/write without needing to worry about locking for race
conditions or unexpected failure.

```
my $id = 1;

my $t = DBIish::Transaction.new(:retry,
    connection => { DBIish.connect('Pg', :$database) },
    begin => -> $dbh { $dbh.do(q{ BEGIN ISOLATION LEVEL SERIALIZABLE } ) },
    :retry
).in-transaction: -> $dbh {
    my $sth = $dbh.prepare('SELECT col FROM tabl WHERE id = $1');
    $sth.execute($id);
    my $row = $sth.row(:hash);

    my $sth = $dbh.prepare('UPDATE INTO tabl SET col = $2 WHERE id = $1');
    $sth.execute( $id, $row<col> * complex_function() );
}

```

### :rollback($dbh)

```
{  $_.do(q{ROLLBACK})  }

```

By default this is a Callable which performs the simplest rollback statement.

NOTE: `AND CHAIN` type modifications will require you to provide some non-trivial logic in the `begin` callable.

### :after-rollback(Int $transaction-retry-attempt)

Callable which will be called after a rollback is attempted. This is useful for resetting state for another attempt at
the DB transaction work, or for logging/debugging purposes.

### :commit($dbh)

```
{  $_.do(q{COMMIT})  }

```

By default this is a Callable which performs the simplest commit statement.

NOTE: `AND CHAIN` type modifications will require you to provide some non-trivial logic in the `begin` callable.

### :retry

Catches errors [marked temporary](https://github.com/raku-community-modules/DBIish#statement-exceptions) by DBIish. The
transaction in progress will be rolled back and a new transaction started. The function body is expected to be
idempotent for non-database work as it may be executed multiple times.

If `:connection` is provided a function, this will retry on a database connectivity issue as well by establishing
a new connection and attempting to execute the transaction body.

### :max-retry-count

Number of times to retry the work after a temporary failure before giving up.

3 by default.

## DBIish::Savepoint

```
DBIish::Transaction.new(:connection, :begin, :rollback, :commit);

```

### :connection

A DBDish::Connection with a currently active transaction.

### :begin($dbh)

```
{  $_.do(q{SAVEPOINT <random name>})  }

```

By default this is a Callable which performs the simplest `SAVEPOINT` statement. A random name is selected.

### :rollback($dbh)

```
{  $_.do(q{ROLLBACK TO SAVEPOINT <random name>})  }

```

By default this is a Callable which performs the simplest `ROLLBACK TO SAVEPOINT` statement.

### :after-rollback()

Callable which will be called after a rollback is attempted. This is useful for resetting state for another attempt,
or for logging/debugging purposes.

### :release($dbh)

```
{  $_.do(q{RELEASE SAVEPOINT})  }

```

By default this is a Callable which performs the simplest `RELEASE SAVEPOINT` statement. This free's the savepoint
related resources on the database side.

## LICENSE

All files in this repository are licensed under the terms of the Creative Commons CC0 License; for details,
please see the LICENSE file


## temp.md
temp

Combined from primary sources listed below.

# [In Operators](#___top "go to top of document")[§](#(Operators)_prefix_temp "direct link")

See primary documentation
[in context](/language/operators#prefix_temp)
for **prefix temp**.

```raku
sub prefix:<temp>(Mu $a is rw)
```

"temporizes" the variable passed as the argument. The variable begins with the same value as it had in the outer scope, but can be assigned new values in this scope. Upon exiting the scope, the variable will be restored to its original value.

```raku
my $a = "three";
say $a; # OUTPUT: «three␤»
{
    temp $a;
    say $a; # OUTPUT: «three␤»
    $a = "four";
    say $a; # OUTPUT: «four␤»
}
say $a; # OUTPUT: «three␤»
```

You can also assign immediately as part of the call to temp:

```raku
temp $a = "five";

```

Be warned the `temp` effects get removed once the block is left. If you were to access the value from, say, within a [`Promise`](/type/Promise) after the `temp` was undone, you'd get the original value, not the `temp` one:

```raku
my $v = "original";
{
    temp $v = "new one";
    start {
        say "[PROMISE] Value before block is left: `$v`";
        sleep 1;
        say "[PROMISE] Block was left while we slept; value is now `$v`";
    }
    sleep ½;
    say "About to leave the block; value is `$v`";
}
say "Left the block; value is now `$v`";
sleep 2;

# OUTPUT:
# [PROMISE] Value before block is left: `new one`
# About to leave the block; value is `new one`
# Left the block; value is now `original`
# [PROMISE] Block was left while we slept; value is now `original`

```

# [In Variables](#___top "go to top of document")[§](#(Variables)_prefix_temp "direct link")

See primary documentation
[in context](/language/variables#The_temp_prefix)
for **The temp prefix**.

Like `my`, `temp` restores the old value of a variable at the end of its scope. However, `temp` does not create a new variable.

```raku
my $in = 0; # temp will "entangle" the global variable with the call stack
            # that keeps the calls at the bottom in order.
sub f(*@c) {
    (temp $in)++;
     "<f>\n"
     ~ @c».indent($in).join("\n")
     ~ (+@c ?? "\n" !! "")
     ~ '</f>'
};
sub g(*@c) {
    (temp $in)++;
    "<g>\n"
    ~ @c».indent($in).join("\n")
    ~ (+@c ?? "\n" !! "")
    ~ "</g>"
};
print g(g(f(g()), g(), f()));

# OUTPUT: «<g>
#           <g>
#            <f>
#             <g>
#             </g>
#            </f>
#            <g>
#            </g>
#            <f>
#            </f>
#           </g>
#          </g>␤»
```