## dist_zef-patrickb-Devel-ExecRunnerGenerator.md
```
=begin pod

=head1 NAME

Devel::ExecRunnerGenerator

=head1 SYNOPSIS

=begin code :lang

use Devel::ExecRunnerGenerator;
Devel::ExecRunnerGenerator::generate(
    program => "bin/raku",
    cwd => ".",
    args => [
        "./path/to/some/script.raku",
        ""
    ],
    arg0 => "some-fake-name",
    env-add => {
        DEBUG => 1,
    },
    env-remove => [
        "LD_PRELOAD",
    ],
    archs => [
        "posix",
        "windows-x86_64.exe",
    ],
    out-path => ".",
    :overwrite
);

=end code

=head1 DESCRIPTION

A tool to generate native wrapper executables (similar to the infamous .bat/.sh wrappers)

=head2 Paths

Paths are always to be written with forward slashes as separators.

=head2 Argument operators

The I and I parameters must have one of the below operators applied to them.
Operators are applied by simply prefixing them to the string.

=defn
Use the arg unchanged

=defn
Insert the passed arguments. Must not be followed by anything.

=defn
Change path (with slashes) to have the platform separators.

=defn
Turn into an absolute path. The base to prefix is the directory the wrapper
executable is located in. Separators are normalized to the platform path separators.

=defn
Turn into an absolute path. The base to prefix is the directory the wrapper
executable is located in. Separators are normalized to be a slash.

=head2 Arguments

=head3 program

Program to call. Either a program name to be searched in PATH, or a path.
The following Is are supported:

=item
=item
=item
=item

Do note that the PATH of the environment I modification by the
I and I have been done. So clearing out the
PATH variable and then trying to call a program via PATH won't work.

=head3 arg0

Use a custom arg0 instead of the program name. This is only supported on
Windows, as it's not possible to set arg0 in an exec call using a POSIX shell.
All platforms except for Windows generate POSIX shell code.

=head3 cwd

The working directory to switch to before calling the program.
If empty or missing, the working directory will be left unchanged.
Either pass an absolute path and use the I operator or pass a path
relative to the wrappers parent directory and use the I operator.
To set the working directory to the wrappers parent directory itself pass ".".

The following Is are supported:

=item
=item

=head3 args

The arguments to pass to the program.
The following Is are supported:

=item
=item
=item
=item
=item

=head3 env-add

Hash of environment variables to add / overwrite in the programs
environment.

=head3 env-remove

List of environment variables to remove from the programs env.

=head1 Standalone usage

A script called `exec-runner-generator` is also provided, which provides access
to the above described functionality without having to write any code. The
program requires a single argument, a path to a configuration file containing
JSON text of the above arguments. An example configuration file is provided at
`doc/example.json`.

=head1 AUTHOR

Patrick Böker

=head1 COPYRIGHT AND LICENSE

Copyright 2020-2022 Patrick Böker

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

=end pod

```


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

# NAME

SeqSplitter - Creates `.pull-while`, `.pull-until`, `.pull`, `.skip-while`, `.skip-until` and `.skip` on `Seq` and `Any`.

# SYNOPSIS

```
use SeqSplitter;
say ^10
   .pull-while(* < 2)
   .skip-while(* < 5)
   .pull-until(7)
   .skip-until(8)
   .pull
   .skip(3)
;

```

Will print:

```
(0 1 5 6 8)

```

# DESCRIPTION

SeqSplitter is a "better solution" for `.toggle` it was being discussed here <https://github.com/rakudo/rakudo/issues/2089>

# AUTHOR

Fernando Correa de Oliveira [fernandocorrea@gmail.com](mailto:fernandocorrea@gmail.com)

# COPYRIGHT AND LICENSE

Copyright 2018 Fernando Correa de Oliveira

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


## dist_zef-stuart-little-RakuRename.md
# RakuRename

A file-rename tool inspired by Perl's [File::Rename](https://metacpan.org/dist/File-Rename/view/rename.PL).

## Installation

If you have [zef](https://github.com/ugexe/zef), there are a number of options:

* just run `zef install RakuRename`;
* or clone this repo and issue `zef install <path-to-cloned-repo>`;
* as yet another variation, after cloning it, `cd` into the repo and `zef install .` (note the dot at the end).

Additionally, since all there is here, really, is the executable `bin/rrnm`, you can just download that and use it.

## Usage

The distribution only provides the `rrnm` binary. In general:

* Run `rrnm --help` to see information on the possible command-line switches / options.
* The first positional argument should be a substitution or transliteration operator, as documented under `Raku`'s [substitution-operators](https://docs.raku.org/language/operators#Substitution_operators) doc section.
* The positional arguments following that should be the files you want to move / copy / whatever (see the examples below).
* The regex syntax is whatever `Raku` [will recognize](https://docs.raku.org/language/regexes).

## Examples

Some usage examples follow, all of which are to be run in a terminal where you have access to `zef`-installed binaries.

```
rrnm 's/^a/b/' <DIRECTORY>/a*

```

will rename every file / directory of the form `<DIRECTORY>/a<BLAH>` to `<DIRECTORY>/b<BLAH>`.

On the other hand,

```
rrnm -c='cp' 's/^a/b/' <DIRECTORY>/a*

```

will take every file of the form `<DIRECTORY>/a<BLAH>` and *copy* it to `<DIRECTORY>/b<BLAH>`. It will complain about not being able to copy directories among those (because the [cp command](https://linux.die.net/man/1/cp) behaves this way), but you can fix that with

```
rrnm -c='cp -r' 's/^a/b/' <DIRECTORY>/a*

```

You can even do the following in a `git` repo, to effect a regex-based [git-mv](https://git-scm.com/docs/git-mv):

```
rrnm -c='git mv' 's/^(\d)/0$0/' [0-9]*

```

or equivalently, using [lookahead assertions](https://docs.raku.org/language/regexes#Lookahead_assertions),

```
rrnm -c='git mv' 's/^<?before \d>/0/' [0-9]*

```

That will perform a `git mv` on every file whose name starts with a digit, prepending a `0` (if you wanted to do this for some reason).

The `--dry` option just *shows* you the command that would be run. So in a git repo that contains files `1.txt` and `2.txt` (and nothing else starting with a digit),

```
rrnm -c='git mv' 's/^(\d)/0$0/' [0-9]* --dry

```

would simply show you

```
git mv 1.txt ./01.txt
git mv 2.txt ./02.txt

```

in the terminal.

I use this all the time: first run what you *think* will work with `--dry`, then recall the last command and remove the `--dry` option.


## keys.md
keys

Combined from primary sources listed below.

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

See primary documentation
[in context](/type/List#routine_keys)
for **routine keys**.

```raku
sub    keys($list --> Seq:D)
method keys(List:D: --> Seq:D)
```

Returns a sequence of indexes into the list (e.g., `0...(@list.elems-1)`).

```raku
say (1,2,3,4).keys; # OUTPUT: «(0 1 2 3)␤»
```

# [In role Baggy](#___top "go to top of document")[§](#(role_Baggy)_method_keys "direct link")

See primary documentation
[in context](/type/Baggy#method_keys)
for **method keys**.

```raku
method keys(Baggy:D: --> Seq:D)
```

Returns a [`Seq`](/type/Seq) of all keys in the `Baggy` object without taking their individual weights into account as opposed to [kxxv](#method_kxxv).

```raku
my $breakfast = bag <eggs spam spam spam>;
say $breakfast.keys.sort;                        # OUTPUT: «(eggs spam)␤»

my $n = ("a" => 5, "b" => 2).BagHash;
say $n.keys.sort;                                # OUTPUT: «(a b)␤»
```

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

See primary documentation
[in context](/type/Capture#method_keys)
for **method keys**.

```raku
multi method keys(Capture:D: --> Seq:D)
```

Returns a [`Seq`](/type/Seq) containing all positional keys followed by all named keys. For positional arguments the keys are the respective arguments ordinal position starting from zero.

```raku
my $capture = \(2, 3, 5, apples => (red => 2));
say $capture.keys; # OUTPUT: «(0 1 2 apples)␤»
```

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

See primary documentation
[in context](/type/Map#method_keys)
for **method keys**.

```raku
method keys(Map:D: --> Seq:D)
```

Returns a [`Seq`](/type/Seq) of all keys in the Map.

```raku
my $m = Map.new('a' => (2, 3), 'b' => 17);
say $m.keys; # OUTPUT: «(a b)␤»
```

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

See primary documentation
[in context](/type/Pair#method_keys)
for **method keys**.

```raku
multi method keys(Pair:D: --> List:D)
```

Returns a [`List`](/type/List) containing the [key](/type/Pair#method_key) of the invocant.

```raku
say (Raku => "d").keys;                           # OUTPUT: «(Raku)␤»
```

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

See primary documentation
[in context](/type/Any#method_keys)
for **method keys**.

```raku
multi method keys(Any:U: --> List)
multi method keys(Any:D: --> List)
```

For defined `Any` returns its [keys](/routine/keys) after calling `list` on it, otherwise calls `list` and returns it.

```raku
my $setty = Set(<Þor Oðin Freija>);
say $setty.keys; # OUTPUT: «(Þor Oðin Freija)␤»
```

See also [`List.keys`](/type/List#routine_keys).

Trying the same on a class will return an empty list, since most of them don't really have keys.

# [In role Setty](#___top "go to top of document")[§](#(role_Setty)_method_keys "direct link")

See primary documentation
[in context](/type/Setty#method_keys)
for **method keys**.

```raku
multi method keys(Setty:D: --> Seq:D)
```

Returns a [`Seq`](/type/Seq) of all elements of the set.

```raku
my $s = Set.new(1, 2, 3);
say $s.keys;                                      # OUTPUT: «(3 1 2)␤»
```


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

# NAME

List::Allmax - Find all of the maximum or minimum elements of a list.

# SYNOPSIS

```
use List::Allmax;

say (^20).roll(50).&all-max;     # values

say (^20).roll(50).&all-min: :k; # keys

say [1,2,3,4,5,5,4,3,2,1,2,2,5,4,4].classify({$_}).sort.List.&all-max( :by(+*.value) );
# [2 => [2,2,2,2], 4 => [4,4,4,4]]

```

# DESCRIPTION

Raku provides `max` and `min` routines to find the maximum or minimum elements of a list. If there is more than one value that evaluates to the maximum, (minimum) only the first is reported, no matter how many there may be. This module provides a remedy for that.

Provides the routines `all-max()` and `all-min()` that return *all* of the elements that evaluate to maximum or minimum value.

Similar to the built-ins, you may request either a list of values or a list of indicies (keys) where those values are located.

If you want to compare based on something other than the values of the individual elements, supply a named `:by()` Callable block to be used as an evaluator. Defaults to `{$_}` (self).

Note: Only operates on Positional objects. If want to use it on a Hash or some other Associative type, coerce to a Listy type object first.

# AUTHOR

Stephen Schulze (aka thundergnat [thundergnat@comcast.net](mailto:thundergnat@comcast.net))

# COPYRIGHT AND LICENSE

Copyright 2023 thundergnat

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


## dist_zef-nige123-SHAI.md
# shai (shell ai)

LLM-powered utility for requesting and executing shell commands.

Make a request using natural language and **shai** prompts an LLM for a shell command to fulfil your request.

It's OK to feel shy about executing the suggested command.

The command will not execute without your confirmation. Please be careful when confirming.

## Usage

```
    shell> shai ask for what you want              -- in natural language

    shell> shai what processes are using the most memory
    shell> shai how much disk space is left
    shell> shai what programs have ports open
    shell> shai remove .tmp files larger than 100 meg

    shell> shai config                             -- change LLM settings
    shell> shai help                               -- show this help

```

## Install

**shai** is a Raku command-line utility.

1. Install Raku

   <https://raku.org/downloads/>
2. Install shai

   ```
   shell> zef install SHAI

   ```
3. Set up your LLM with LLM::DWIM

   ```
   shell> rakudoc LLM::DWIM

   ```


## permutations.md
permutations

Combined from primary sources listed below.

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

See primary documentation
[in context](/type/Any#method_permutations)
for **method permutations**.

```raku
method permutations(|c)
```

Coerces the invocant to a `list` by applying its [`.list`](/routine/list) method and uses [`List.permutations`](/type/List#routine_permutations) on it.

```raku
say <a b c>.permutations;
# OUTPUT: «((a b c) (a c b) (b a c) (b c a) (c a b) (c b a))␤»
say set(1,2).permutations;
# OUTPUT: «((2 => True 1 => True) (1 => True 2 => True))␤»
```

Permutations of data structures with a single or no element will return a list containing an empty list or a list with a single element.

```raku
say 1.permutations; # OUTPUT: «((1))␤»
```

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

See primary documentation
[in context](/type/List#routine_permutations)
for **routine permutations**.

```raku
multi        permutations(Int()    $from --> Seq:D)
multi        permutations(Iterable $from --> Seq:D)
multi method permutations(List:D:        --> Seq:D)
```

Returns all possible permutations of a list as a [`Seq`](/type/Seq) of lists:

```raku
.say for <a b c>.permutations;
# OUTPUT:
# (a b c)
# (a c b)
# (b a c)
# (b c a)
# (c a b)
# (c b a)
```

`permutations` treats all elements as unique, thus `(1, 1, 2).permutations` returns a list of 6 elements, even though there are only three distinct permutations, due to first two elements being the same.

The subroutine form behaves the same as the method form, computing permutations from its first argument `$from`. If `$from` is not an [`Iterable`](/type/Iterable), coerces `$from` to an [`Int`](/type/Int) and picks from a [`Range`](/type/Range) constructed with `0..^$from`:

```raku
.say for permutations 3;
# OUTPUT:
# (0 1 2)
# (0 2 1)
# (1 0 2)
# (1 2 0)
# (2 0 1)
# (2 1 0)
```


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

Extract archived files with the help of various archivers programs.

Archive formats supported:

```
+-----------+---------------------------+
| extension | internal archive program  |
+-----------+---------------------------+
| *.zip     | unzip                     |
| *.tar     | tar                       |
| *.tar.gz  | tar                       |
| *.gem     | gem                       |
+-----------+---------------------------+

```

# Build Status

[![Build Status](https://travis-ci.org/melezhik/sparrowdo-archive.svg?branch=master)](https://travis-ci.org/melezhik/sparrowdo-archive)

# INSTALL

```
$ zef install Sparrowdo::Archive

```

# USAGE

Through cli

```
s6 --module-run Archive@source=test.tar.gz,target=/tmp/foo2,verbose=1

```

Through Sparrow6 DSL

```
module-run 'Archive', %(
  source  => '/tmp/foo/test.tar.gz',
  target  => '/tmp/foo2',
  verbose => 1,
);

```

# Parameters

## source

A local file path to archived file.

Obligatory. No default.

## target

A local file path where to store extracted archive data. No default value. Obligatory.

## user

A user which run a archive program and thus to which user extracted files will belong to.

Optional. No default value.

## no-install-deps

Don't install dependencies ( tar/gzip package, etc ).

Optional.

## verbose

Try to run archive extractor program in verbose mode. Default value is `0` ( no verbose ).

Optional.

# Author

[Alexey Melezhik](melezhik@gmail.com)


## dist_cpan-ALLSOPP-Operator-dB.md
# Operator::dB

Operator to support decibel (dB) arithmetic.

```
use Operator::dB;

put 100 + 3dB;
# 199.52623149688796

put 100 - 3dB;
# 50.11872336272723

put 10dB + 20dB;
# 20.413927dB

```

## Description

The interface tries to be intuitive while avoiding ambiguity. For example, the
following makes sense (adding 3dB is approximately equivalent to doubling).

```
10 + 3dB
# 19.952623149688794

```

But the following doesn't make sense. It could represent either `13dB` or
`10.8dB` (i.e. `3dB + 10dB`).

```
3dB + 10 # DOESN'T WORK!

```

All supported operations are discussed in the following subsections.

### Addition and subtraction on numbers

Adding or subtracting decibel values to and from numbers (of `Numeric` type)
scales the number by the corresponding decibel gain:

```
put 100 + 3dB;
# 199.52623149688796

put 100 - 3dB;
# 50.11872336272723

```

### Addition and subtraction on decibels

Decibels can be added to, or subtracted from, each other.

This type of operation returns an `Operator::dB::Decibel` wrapper object:

```
my $foo = 3dB + 2dB - 1dB;
# Operator::dB::Decibel.new(x => 10, y => 0.365...)

```

You can get the decibel value itself with `.dB`:

```
$foo.dB;
# 3.6571819272302735

```

Or by stringification:

```
"The gain is: $foo";
# The gain is: 3.657182dB

```

Or by defining your own format with `.fmt`:

```
$foo.fmt("%.1f dB(A)");
# 3.7 dB(A)

```

## Caveats

This package exports overloads to built-in operators, which is potentially
reckless. But the operator signatures all contain at least one
`Operator::dB::Decibel` object (which is not built-in), so it *should* be
fine!

The `Num` method is not implemented on the wrapper class, so many built-in
numerical operations don't work, e.g. `1dB * 1`. This is a necessary
limitation because decibel arithmetic is only semantically valid for addition
and subtraction AFAIK.

## See also

* [Operators in Raku](https://docs.raku.org/language/operators)
* [Creating operators in Raku](https://docs.raku.org/language/optut)


## dist_cpan-HANENKAMP-Amazon-DynamoDB.md
# NAME

Amazon::DynamoDB - Low-level access to the DynamoDB API

# SYNOPSIS

```
use Amazon::DynamoDB;

my $ddb = Amazon::DynamoDB.new

await $ddb.CreateTable(
    AttributeDefinitions => [
        {
            AttributeName => 'ForumName',
            AttributeType => 'S',
        },
        {
            AttributeName => 'Subject',
            AttributeType => 'S',
        },
        {
            AttributeName => 'LastPostDateTime',
            AttributeType => 'S',
        },
    ],
    TableName => 'Thread',
    KeySchema => [
        {
            AttributeName => 'ForumName',
            KeyType       => 'HASH',
        },
        {
            AttributeName => 'Subject',
            KeyType       => 'RANGE',
        },
    ],
    LocalSecondaryIndexes => [
        {
            IndexName => 'LastPostIndex',
            KeySchema => [
                {
                    AttributeName => 'ForumName',
                    KeyType       => 'HASH',
                },
                {
                    AttributeName => 'LastPostDateTime',
                    KeyType       => 'RANGE',
                }
            ],
            Projection => {
                ProjectionType => 'KEYS_ONLY'
            },
        },
    ],
    ProvisionedThroughput => {
        ReadCapacityUnits  => 5,
        WriteCapacityUnits => 5,
    },
);

$ddb.PutItem(
    TableName => "Thread",
    Item => {
        LastPostDateTime => {
            S => "201303190422"
        },
        Tags => {
            SS => ["Update","Multiple Items","HelpMe"]
        },
        ForumName => {
            S => "Amazon DynamoDB"
        },
        Message => {
            S => "I want to update multiple items in a single call. What's the best way to do that?"
        },
        Subject => {
            S => "How do I update multiple items?"
        },
        LastPostedBy => {
            S => "fred@example.com"
        }
    },
    ConditionExpression => "ForumName <> :f and Subject <> :s",
    ExpressionAttributeValues => {
        ':f' => {S => "Amazon DynamoDB"},
        ':s' => {S => "How do I update multiple items?"}
    }
);

my $res = await $ddb.GetItem(
    TableName => "Thread",
    Key => {
        ForumName => {
            S => "Amazon DynamoDB"
        },
        Subject => {
            S => "How do I update multiple items?"
        }
    },
    ProjectionExpression => "LastPostDateTime, Message, Tags",
    ConsistentRead => True,
    ReturnConsumedCapacity => "TOTAL"
);

say "Message: $res<Item><Message><S>";

```

# DESCRIPTION

This module provides an asynchronous, low-level API that interacts directly with DynamoDB. This is a low-level implementation that sticks as close as possible to the API described by AWS, keeping the names of actions and parameter names as-is (i.e., not using nice kabob-case most Perl 6 modules use, but the PascalCase that most AWS APIs present natively). This has the benefit of allowing you to use the AWS documentation directly.

The API is currently very primitive and may change to provide better type-checking in the future.

# DIAGNOSTICS

The following exceptions may be thrown by this module:

## X::Amazon::DynamoDB::APIException

This encapsulates the errors returned from the API itself. The name of the error can be checked at the `type` method and the message in `message`. It has the following accessors:

* request-id The request id returned with the error.
* raw-type The \_\_type returned with the error (a combination of the API version and error type).
* type The error type pulled from the raw-type.
* message The detailed message sent with the error.

This is the exception you will most likely want to capture. For this reason, a special helper named `of-type` is provided to aid in easy matching.

For example, if you want to perform a `CreateTable` operation, but ignore any "ResourceInUseException" indicating that the table already exists, it is recommended that you do something like this:

```
my $ddb = Amazon::DynamoDB.new;
$ddb.CreateTable( ... );

CATCH {
    when X::Amazon::DynamoDB::APIException.of-type('ResourceInUseException') {
        # ignore
    }
}

```

## X::Amazon::DynamoDB::CommunicationError

This is a generic error, generally caused by HTTP connection problems, but might be caused by especially fatal errors in the API. The message is simply "Communication Error", but provides two attributes for more information:

* request This is the `HTTP::Request` that was attempted.
* response This is the `HTTP::Response` that was received (which might be a fake response generated by the user agent if no response was received.

## X::Amazon::DynamoDB::CRCError

Every response from DynamoDB includes a CRC32 checksum. This module verifies that checksum on every request. If the checksum given by Amazon does not match the checksum calculated, this error will be thrown.

It provides these attributes:

* got-crc32 This is the integer CRC32 we calculated.
* expected-crc32 This is the integer CRC32 Amazon sent.

# ASYNC API

The API for this is asynchronous. Mostly, this means that the API methods return a <Promise> that will be kept with a <Hash> containing the results. If you want a purely syncrhonous API, you just need to place an `await` before every call to the library.

Under the hood, the implementation is currently implemented to use Cro::HTTP::Client if present. If not present, then [HTTP::UserAgent](http::UserAgent) is used instead, though all actions will run on separate threads from the calling thread.

# METHODS

## method new

```
multi method new(
    AWS::Session :$session,
    AWS::Credentials :$credentials,
    Str :$scheme = 'https',
    Str :$domain = 'amazonaws.com',
    Str :$hostname,
    Int :$port,
    HTTP::UserAgent :$ua,
) returns Amazon::DynamoDB

```

All arguments to new are optional. The `$session` and `$credentials` will be constructed lazily if not given to `new` using default settings.

By default, the `$port` and `$hostname` are unset. This means that no port will be specified (just the default port for the scheme will be used) and the `hostname` used till be constructed from the `$domain` and region defined in the session.

See AWS::Session and AWS::Credentials for details on how to customize your settings. However, if you are familiar with how botocore/aws-cli and other tools configure themselves, this will be familiar.

## method session

```
method session() returns AWS::Session is rw

```

Getter/setter for the session used to configure AWS settings.

## method credentials

```
method credentials() returns AWS::Credentials is rw

```

Getter/setter for the credentails used to contact AWS.

## method scheme

```
method scheme() returns Str

```

Getter for the scheme. Defaults to "https".

## method domain

```
method domain() returns Str

```

Getter for the domain. Defaults to "amazonaws.com".

## method hostname

```
method hostname() returns Str

```

This returns the hostname that will be contacted with DynamoDB calls. It is either set by the `hostname` setting when calling `new` or constructed from the `domain` and configured region.

## method port

```
method port() returns Int

```

This returns the port number to use when contacting DynamoDB. This returns `Nil` if the default port is used (i.e., 80 when `scheme` is "http" or 443 when "https").

# API METHODS

These are the methods implemented as part of the AWS API. Please see the AWS API documentation for more detail as to what each argument does and the structure of the return value.

## method BatchGetItem

```
method BatchGetItem(
         :%RequestItems!,
    Str  :$ReturnConsumedCapacity,
) returns Promise

```

The BatchGetItem operation returns the attributes of one or more items from one or more tables. You identify requested items by primary key.

See the [AWS BatchGetItem API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchGetItem.html).

## method BatchWriteItem

```
method BatchWriteItem(
         :%RequestItems!
    Str  :$ReturnConsumedCapacity,
    Str  :$ReturnItemCollectionMetrics,
) returns Promise

```

The BatchWriteItem operation puts or deletes multiple items in one or more tables. A single call to BatchWriteItem can write up to 16 MB of data, which can comprise as many as 25 put or delete requests. Individual items to be written can be as large as 400 KB.

See the [AWS BatchWriteItem API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchWriteItem.html).

## method DeleteItem

```
method DeleteItem(
         :%Key!,
    Str  :$TableName!,
    Str  :$ConditionalOperator,
    Str  :$ConditionExpression,
    Str  :$Expected,
         :%ExpressionAttributeNames,
         :%ExpressionAttributeValues,
    Str  :$ReturnConsumedCapacity,
    Str  :$ReturnItemCollectionMetrics,
    Str  :$ReturnValues,
) returns Promise

```

Deletes a single item in a table by primary key. You can perform a conditional delete operation that deletes the item if it exists, or if it has an expected attribute value.

See the [AWS DeleteItem API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DeleteItem.html).

## method GetItem

```
method GetItem(
         :%Key!,
    Str  :$TableName!,
         :@AttributesToGet,
    Bool :$ConsistentRead,
         :%ExpressionAttributeNames,
    Str  :$ProjectionExpression,
    Str  :$ReturnConsumedCapacity,
) returns Promise

```

The GetItem operation returns a set of attributes for the item with the given primary key. If there is no matching item, GetItem does not return any data and there will be no Item element in the response.

See the [AWS GetItem API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_GetItem.html).

## method PutItem

```
method PutItem(
         :%Item!,
    Str  :$TableName!,
    Str  :$ConditionalOperator,
    Str  :$ConditionExpression,
         :%Expected,
         :%ExressionAttributeNames,
         :%ExpressionAttributeValues,
    Str  :$ReturnConsumedCapacity,
    Str  :$ReturnItemCollectionMetrics,
    Str  :$ReturnValues,
) returns Promise

```

Creates a new item, or replaces an old item with a new item. If an item that has the same primary key as the new item already exists in the specified table, the new item completely replaces the existing item. You can perform a conditional put operation (add a new item if one with the specified primary key doesn't exist), or replace an existing item if it has certain attribute values. You can return the item's attribute values in the same operation, using the ReturnValues parameter.

See the [AWS PutItem API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_PutItem.html).

## method Query

```
method Query(
    Str  :$TableName!,
         :@AttributesToGet,
    Str  :$ConditionalOperator,
    Bool :$ConsistentRead,
         :%ExclusiveStartKey,
         :%ExpressionAttributeNames,
         :%ExpressionAttributeValues,
    Str  :$FilterExpression,
    Str  :$IndexName,
    Str  :$KeyConditionExpression,
         :%KeyConditions,
    Int  :$Limit,
    Str  :$ProjectionExpression,
         :%QueryFilter,
    Str  :$ReturnConsumedCapacity,
    Bool :$ScanIndexForward,
    Str  :$Select,
) returns Promise

```

The Query operation finds items based on primary key values. You can query any table or secondary index that has a composite primary key (a partition key and a sort key).

See the [AWS Query API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html).

## method Scan

```
method Scan(
    Str  :$TableName!,
         :@AttributesToGet,
    Str  :$ConditionalOperator,
    Bool :$ConsistentRead,
         :%ExclusiveStartKey,
         :%ExpressionAttributeNames,
         :%ExpressionAttributeValues,
    Str  :$FilterExpression,
    Str  :$IndexName,
    Int  :$Limit,
    Str  :$ProjectionExpression,
         :%QueryFilter,
    Str  :$ReturnConsumedCapacity,
         :%ScanFilter,
    Int  :$Segment,
    Str  :$Select,
    Int  :$TotalSegments,
) returns Promise

```

The Scan operation returns one or more items and item attributes by accessing every item in a table or a secondary index. To have DynamoDB return fewer items, you can provide a FilterExpression operation.

See the [AWS Scan API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Scan.html).

## method UpdateItem

```
method UpdateItem(
         :%Key!,
    Str  :$TableName!,
         :%AttributeUpdates,
    Str  :$ConditionalOperator,
    Str  :$ConditionExpression,
         :%Expected,
         :%ExpressionAttributeNames,
         :%ExpressionAttributeValues,
    Str  :$ReturnConsumedCapacity,
    Str  :$ReturnItemCollectionMetrics,
    Str  :$ReturnValues,
    Str  :$UpdateExpression,
) returns Promise

```

Edits an existing item's attributes, or adds a new item to the table if it does not already exist. You can put, delete, or add attribute values. You can also perform a conditional update on an existing item (insert a new attribute name-value pair if it doesn't exist, or replace an existing name-value pair if it has certain expected attribute values).

See the [AWS UpdateItem API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html).

## method CreateTable

```
method CreateTable(
         :@AttributeDefinitions!,
    Str  :$TableName!,
         :@KeySchema!,
         :%ProvisionedThroughput!,
         :@GlobalSecondaryIndexes,
         :@LocalSecondaryIndexes,
         :%SSESpecification,
         :%StreamSpecification,
) returns Promise

```

The CreateTable operation adds a new table to your account. In an AWS account, table names must be unique within each region. That is, you can have two tables with same name if you create the tables in different regions.

See the [AWS CreateTable API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_CreateTable.html).

## method DeleteTable

```
method DeleteTable(
    Str :$TableName,
) returns Promise

```

The DeleteTable operation deletes a table and all of its items. After a DeleteTable request, the specified table is in the DELETING state until DynamoDB completes the deletion. If the table is in the ACTIVE state, you can delete it. If a table is in CREATING or UPDATING states, then DynamoDB returns a ResourceInUseException. If the specified table does not exist, DynamoDB returns a ResourceNotFoundException. If table is already in the DELETING state, no error is returned.

See the [AWS DeleteTable API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DeleteTable.html).

## method DescribeTable

```
method DescribeTable(
    Str  :$TableName!,
) returns Promise

```

Returns information about the table, including the current status of the table, when it was created, the primary key schema, and any indexes on the table.

See the [AWS DescribeTable API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeTable.html).

## method DescribeTimeToLive

```
method DescribeTimeToLive(
    Str  :$TableName!,
) returns Promise

```

Gives a description of the Time to Live (TTL) status on the specified table.

See the [AWS DescribeTimeToLive API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeTimeToLive.html).

## method ListTables

```
method ListTables(
    Str  :$ExclusiveStartTableName,
    Int  :$Limit,
) returns Promise

```

Returns an array of table names associated with the current account and endpoint. The output from ListTables is paginated, with each page returning a maximum of 100 table names.

See the [AWS ListTables API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ListTables.html).

## method UpdateTable

```
method UpdateTable(
    Str  :$TableName!,
         :@AttributeDefinitions,
         :@GlobalSecondaryIndexUpdates,
         :%ProvisionedThroughput,
         :%StreamSpecification,
) returns Promise

```

Modifies the provisioned throughput settings, global secondary indexes, or DynamoDB Streams settings for a given table.

See the [AWS UpdateTable API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateTable.html).

## method UpdateTimeToLive

```
method UpdateTimeToLive(
    Str  :$TableName!,
         :%TableToLiveSpecification!,
) returns Promise

```

The UpdateTimeToLive method will enable or disable TTL for the specified table. A successful UpdateTimeToLive call returns the current TimeToLiveSpecification; it may take up to one hour for the change to fully process. Any additional UpdateTimeToLive calls for the same table during this one hour duration result in a ValidationException.

See the [AWS UpdateTimeToLive API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateTimeToLive.html).

## method CreateGlobalTable

```
method CreateGlobalTable(
    Str  :$GlobalTableName!,
         :@ReplicationGroup!,
) returns Promise

```

Creates a global table from an existing table. A global table creates a replication relationship between two or more DynamoDB tables with the same table name in the provided regions.

See the [AWS CreateGlobalTable API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_CreateGlobalTable.html).

## method DescribeGlobalTable

```
method DescribeGlobalTable(
    Str  :$GlobalTableName!,
) returns Promise

```

Returns information about the specified global table.

See the [AWS DescribeGlobalTable API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeGlobalTable.html).

## method ListGlobalTables

```
method ListGlobalTables(
    Str  :$ExclusiveStartGlobalTableName,
    Int  :$Limit,
    Str  :$RegionName,
) returns Promise

```

Lists all global tables that have a replica in the specified region.

See the [AWS ListGlobalTables API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ListGlobalTables.html).

## method UpdateGlobalTable

```
method UpdateGlobalTable(
    Str  :$GlobalTableName!,
         :@ReplicaUpdates!,
) returns Promise

```

Adds or removes replicas in the specified global table. The global table must already exist to be able to use this operation. Any replica to be added must be empty, must have the same name as the global table, must have the same key schema, and must have DynamoDB Streams enabled and must have same provisioned and maximum write capacity units.

See the [AWS UpdateGlobalTable API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateGlobalTable.html).

## method ListTagsOfResource

```
method ListTagsOfResource(
    Str  :$ResourceArn!,
    Str  :$NextToken,
) returns Promise

```

List all tags on an Amazon DynamoDB resource. You can call ListTagsOfResource up to 10 times per second, per account.

See the [AWS ListTagsOfResource API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ListTagsOfResource.html).

## method TagResource

```
method TagResource(
    Str  :$ResourceArn!,
         :@Tags!,
) returns Promise

```

Associate a set of tags with an Amazon DynamoDB resource. You can then activate these user-defined tags so that they appear on the Billing and Cost Management console for cost allocation tracking. You can call TagResource up to 5 times per second, per account.

See the [AWS TagResource API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TagResource.html).

## method UntagResource

```
method UntagResource(
    Str  :$ResourceArn!,
         :@TagKeys!,
) returns Promise

```

Removes the association of tags from an Amazon DynamoDB resource. You can call UntagResource up to 5 times per second, per account.

See the [AWS UntagResource API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UntagResource.html).

## method CreateBackup

```
method CreateBackup(
    Str  :$BackupName!,
    Str  :$TableName!,
) returns Promise

```

Creates a backup for an existing table.

See the [AWS CreateBackup API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_CreateBackup.html).

## method DeleteBackup

```
method DeleteBackup(
    Str  :$BackupArn!,
) returns Promise

```

Deletes an existing backup of a table.

See the [AWS DeleteBackup API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DeleteBackup.html).

## method DescribeBackup

```
method DescribeBackup(
    Str  :$BackupArn!,
) returns Promise

```

Describes an existing backup of a table.

See the [AWS DescribeBackup API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeBackup.html).

## method DescribeContinuousBackups

```
method DescribeContinuousBackups(
    Str  :$TableName!,
) returns Promise

```

Checks the status of continuous backups and point in time recovery on the specified table. Continuous backups are ENABLED on all tables at table creation. If point in time recovery is enabled, PointInTimeRecoveryStatus will be set to ENABLED.

See the [AWS DescribeContinuousBackups API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeContinuousBackups.html).

## method ListBackups

```
method ListBackups(
    Str  :$ExclusiveStartBackupArn,
    Int  :$Limit,
    Str  :$TableName,
    Int  :$TimeRangeLowerBound,
    Int  :$TimeRangeUpperBound,
) returns Promise

```

List backups associated with an AWS account. To list backups for a given table, specify TableName. ListBackups returns a paginated list of results with at most 1MB worth of items in a page. You can also specify a limit for the maximum number of entries to be returned in a page.

See the [AWS ListBackups API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ListBackups.html).

## method RestoreTableFromBackup

```
method RestoreTableFromBackup(
    Str  :$BackupArn!,
    Str  :$TargetTableName!,
) returns Promise

```

Creates a new table from an existing backup. Any number of users can execute up to 4 concurrent restores (any type of restore) in a given account.

See the [AWS RestoreTableFromBackup API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_RestoreTableFromBackup.html).

## method DescribeLimits

```
method DescribeLimits() returns Promise

```

Returns the current provisioned-capacity limits for your AWS account in a region, both for the region as a whole and for any one DynamoDB table that you create there.

See the [AWS DescribeLimits API documentation](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeLimits.html).


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

# NAME

Raku port of Perl's getgrnam() and associated built-ins

# SYNOPSIS

```
use P5getgrnam;

my @result = getgrnam(~$*USER);

```

# DESCRIPTION

This module tries to mimic the behaviour of Perl's `getgrnam` and associated built-ins as closely as possible in the Raku Programming Language.

It exports:

```
endgrent getgrent getgrgid getgrnam setgrent

```

# ORIGINAL PERL 5 DOCUMENTATION

```
getgrnam NAME
getgrgid GID
getgrent
setgrent
endgrent
        These routines are the same as their counterparts in the system C
        library. In list context, the return values from the various get
        routines are as follows:

         # 0        1          2           3         4
         ( $name,   $passwd,   $gid,       $members  ) = getgr*

        In scalar context, you get the name, unless the function was a
        lookup by name, in which case you get the other thing, whatever it
        is. (If the entry doesn't exist you get the undefined value.) For
        example:

            $gid   = getgrnam($name);
            $name  = getgrgid($num);

        The $members value returned by getgr*() is a space-separated list
        of the login names of the members of the group.

```

# PORTING CAVEATS

This module depends on the availability of POSIX semantics. This is generally not available on Windows, so this module will probably not work on Windows.

# AUTHOR

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

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!

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

# COPYRIGHT AND LICENSE

Copyright 2018, 2019, 2020, 2021, 2023 Elizabeth Mattijsen

Re-imagined from Perl as part of the CPAN Butterfly Plan.

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


## collation.md
class Collation

Encapsulates instructions about how strings should be sorted

```raku
class Collation { }

```

`Collation` is the class that allows proper sorting, taking into account all Unicode characteristics. It's the class the object [`$*COLLATION`](/language/variables#index-entry-%24*COLLATION) is instantiated to, and thus includes *collation levels*, that is, what kind of features should be looked up when comparing two strings and in which order.

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

## [method set](#class_Collation "go to top of document")[§](#method_set "direct link")

```raku
method set (
    Int :$primary    = 1,
    Int :$secondary  = 1,
    Int :$tertiary   = 1,
    Int :$quaternary = 1)

```

Sets if the different levels should be used in ascending or descending order, or if they are going to be ignored (when set to 0).

```raku
my $*COLLATION = Collation.new;
say 'a' coll 'z'; # OUTPUT: «Less␤»
$*COLLATION.set(:primary(-1));
say 'a' coll 'z'; # OUTPUT: «More␤»

```

## [method primary](#class_Collation "go to top of document")[§](#method_primary "direct link")

```raku
method primary
```

Returns the state of the primary collation level.

## [method secondary](#class_Collation "go to top of document")[§](#method_secondary "direct link")

```raku
method secondary
```

Returns the state of the secondary collation level.

## [method tertiary](#class_Collation "go to top of document")[§](#method_tertiary "direct link")

```raku
method tertiary
```

Returns the state of the tertiary collation level.

## [method quaternary](#class_Collation "go to top of document")[§](#method_quaternary "direct link")

```raku
method quaternary
```

Returns the state of the quaternary collation level.

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

Type relations for `Collation`

raku-type-graph

Collation
Collation

Any
Any

Collation->Any

Mu
Mu

Any->Mu

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


## dist_cpan-JNTHN-Concurrent-Stack.md
# Concurrent::Stack

A lock-free stack data structure, safe for concurrent use.

## Synopsis

```
use Concurrent::Stack;

my $stack = Concurrent::Stack.new;

for 'a'..'z' {
    $stack.push($_);
}

say $stack.elems;       # 26
say $stack.peek;        # z
say $stack.pop;         # z
say $stack.pop;         # y
say $stack.peek;        # x
$stack.push('k');
say $stack.peek;        # k
say $stack.elems;       # 25
say $stack.Seq;         # A Seq iterating a snapshot of the stack
say $stack.list;        # A lazy List with a snapshot of the stack

$stack.pop for ^25;
say $stack.elems;       # 0
my $x = $stack.peek;    # Failure with X::Concurrent::Stack::Empty
my $y = $stack.pop;     # Failure with X::Concurrent::Stack::Empty

```

## Overview

Lock-free data structures may be safely used from multiple threads, yet do not
use locks in their implementation. They achieve this through the use of atomic
operations provided by the hardware. Nothing can make contention between
threads cheap - synchronization at the CPU level is still synchronization -
but lock free data structures tend to scale better.

This lock-free stack data structure uses a linked list of immutable nodes, the
only mutable state being a head pointer to the node representing the stack top
and an element counter mintained through atomic increment/decrement operations.
The element count updates are not performed as part of the stack update, and so
may lag the actual state of the stack. However, since checking the number of
elements to decide whether to `peek` or `pop` is doomed in a concurrent setting
anyway (since another thread may `pop` the last value in the meantime), this is
not problematic. The `elems` method primarily exists so that the number of
elements can be queried once the stack reaches some known stable point (for
example, when a bunch of working threads that `push` to it are all known to
have completed their work).

### Methods

#### push(Any $value)

Pushes a value onto the stack. Returns the value that was pushed.

#### pop()

If the stack is not empty, removes the top value and returns it. Otherwise,
returns a `Failure` containing an exception of type `X::Concurrent::Stack::Empty`.

#### peek()

If the stack is not empty, returns the top value. Otherwise, returns a `Failure`
containing an exception of type `X::Concurrent::Stack::Empty`.

#### elems()

Returns the number of elements on the stack. This value can only be relied upon
when it is known that no threads are pushing/popping from the stack at the
point this method is called. Never use the result of `elems` to decide whether
to `peek` or `pop`, since another thread may `pop` in the meantime. Instead,
check if `peek` or `pop` return a `Failure`.

#### Bool()

Returns `False` if the stack is empty and `True` if the stack is non-empty.
The result can only be relied upon when it is known that no threads are
pushing/popping from the stack at the point this method is called. Never use
the result of `Bool` to decide whether to `peek` or `pop`, since another
thread may `pop` in the meantime. Instead, check if `peek` or `pop` return a
`Failure`.

#### Seq()

Returns a `Seq` that will iterate to a snapshot of the stack content,
starting from the stack top. The snapshot is made at the time this
method is called.

#### list()

Returns a `List` that will lazily evaluate to a snapshot of the stack
content, starting from the stack top. The snapshot is made at the time
this method is called.


## dist_zef-jonathanstowe-RPi-Device-SMBus.md
# RPi::Device::SMBus

i²c on Raspberry Pi for Raku

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

## Synopsis

```

    use RPi::Device::SMBus;

    # Obviously you will need to actually read the data sheet of your device.
    my RPi::Device::SMBus $smbus = RPi::Device::SMBus.new(device => '/dev/i2c-1', address => 0x54);

    $smbus.write-byte(0x10);

    ....

```

## Description

This is an SMBus/i²c interface that has been written and tested for
the Raspberry Pi, however it uses a fairly generic POSIX interface so if
your platform exposes the i²c interface as a character special device
it may work.

In order to use this you will need to install and configure the i2c-dev
kernel module and tools. On a default Debian image you should be able
to just do:

```
sudo apt-get install libi2c-dev i2c-tools

```

And then edit the `/etc/modules` to add the modules by adding:

```
i2c-dev
i2c-bcm2708

```

Or for a Raspberry Pi 3

```
i2c-dev
i2c-bcm2835

```

And then rebooting.

If you have a more recent raspbian you may alternatively be able to use
`raspi-config` where you can turn on `i2c` under "Interfacing Options".

Typicaly the i2c device will be `/dev/i2c-1` on a Raspberry Pi rev
B. or v2 or `/dev/i2c-0` on older versions.

You can determine the bus address of your device by doing:

```
sudo i2cdetect -y 1  # replace the 1 with a 0 for older versions

```

(Obviously the device should be connected, consult the manual for your
device about this.)

Which should give you the hexadecimal address of your device. Some
devices may not respond, so you may want to either check the data sheet
of your device or read the `i2cdetect` manual page to get other options.

It should be noted that because there is no easy way of testing this without
using physical devices then it may not work perfectly in all cases, but I'd
be delighted to receive patches for any issues found.

## Installation

Assuming you have a working Rakudo installation you should be able to install this with *zef* :

```
# From the source directory

zef install .

# Remote installation

zef install RPi::Device::SMBus

```

The tests are likely to completely fail on anything but a Raspberry Pi with the i²c configured as above.

## Support

Suggestions/patches are welcomed via [github](https://github.com/jonathanstowe/RPi-Device-SMBus/issues)

## Licence

This is free software.

Please see the <LICENCE> file in the distribution

© Jonathan Stowe 2015 - 2021


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

# NAME

Data::MessagePack - Raku implementation of MessagePack

# SYNOPSIS

```
use Data::MessagePack;

my $data-structure = {
    key => 'value',
    k2 => [ 1, 2, 3 ]
};

my $packed = Data::MessagePack::pack( $data-structure );

my $unpacked = Data::MessagePack::unpack( $packed );

Or for streaming:

use Data::MessagePack::StreamingUnpacker;

my $supplier = Some Supplier; #Could be from IO::Socket::Async for instance

my $unpacker = Data::MessagePack::StreamingUnpacker.new(
    source => $supplier.Supply
);

$unpacker.tap( -> $value {
    say "Got new value";
    say $value.raku;
}, done => { say "Source supply is done"; } );

```

# DESCRIPTION

The present module proposes an implementation of the MessagePack specification as described on <http://msgpack.org/>. The implementation is now in Pure Raku which could come as a performance penalty opposed to some other packer implemented in C.

# FUNCTIONS

## function pack

That function takes a data structure as parameter, and returns a `Blob` with the packed version of the data structure.

## function unpack

That function takes a `MessagePack` packed message as parameter, and returns the deserialized data structure.

# Author

Pierre Vigier

# Contributors

Timo Paulssen

Source can be located at: <https://github.com/raku-community-modules/MessagePack> . Comments and Pull Requests are welcome.

# COPYRIGHT AND LICENSE

Copyright 2016 - 2018 Pierre Vigier

Copyright 2023, 2025 The Raku Community


## dist_zef-martimm-Gnome-Graphene.md
![](https://martimm.github.io/gnome-gtk3/content-docs/images/gtk-perl6.png)

# Gnome Graphene - A thin layer of types for graphic libraries

![Artistic License 2.0](https://martimm.github.io/label/License-label.svg)

# Description

Graphene contains optimizations for speeding up vector operations; those optimizations are optional, and used only if both Graphene was compiled with support for them and if the system you're running on has them

## Documentation

* [🔗 Website, entry point for all documents and blogs](https://martimm.github.io/)
* [🔗 License document](https://www.perlfoundation.org/artistic_license_2_0)
* [🔗 Release notes of all the packages in `:api<2>`](https://github.com/MARTIMM/gnome-source-skim-tool/blob/main/CHANGES.md)
* [🔗 Issues of all the packages in `:api<2>`](https://github.com/MARTIMM/gnome-source-skim-tool/issues)

# Installation

Do not install this package on its own. Instead install `Gnome::Gtk4` newest api.

`zef install Gnome::Gtk4:api<2>`

# Author

Name: **Marcel Timmerman**
Github account name: **MARTIMM**

# Issues

There are always some problems! If you find one please help by filing an issue at [my github project](https://github.com/MARTIMM/gnome-source-skim-tool/issues).

# Attribution

* The inventors of Raku, formerly known as Perl 6, of course and the writers of the documentation which helped me out every time again and again.
* The builders of all the Gnome libraries and the documentation.
* Other helpful modules for their insight and use.


## dist_cpan-JFORGET-Date-Calendar-Gregorian.md
# NAME

Date::Calendar::Gregorian - Extending the core class 'Date' with strftime and conversions with other calendars

# SYNOPSIS

Printing the date 2020-04-05 in French *without* Date::Calendar::Gregorian

```
use Date::Names;
use Date::Calendar::Strftime;

my Date        $date   .= new('2020-04-05');
my Date::Names $locale .= new(lang => 'fr');

my $day   = $locale.dow($date.day-of-week);
my $month = $locale.mon($date.month);
$date does Date::Calendar::Strftime;

say $date.strftime("$day %d $month %Y");
# --> dimanche 05 avril 2020

```

Printing the date 2020-04-05 in French *with* Date::Calendar::Gregorian

```
use Date::Calendar::Gregorian;
my  Date::Calendar::Gregorian $date .= new('2020-04-05', locale => 'fr');
say $date.strftime("%A %d %B %Y");
# --> dimanche 05 avril 2020

```

# INSTALLATION

```
zef install Date::Calendar::Gregorian

```

or

```
git clone https://github.com/jforget/raku-Date-Calendar-Gregorian.git
cd raku-Date-Calendar-Gregorian
zef install .

```

# DESCRIPTION

Date::Calendar::Gregorian is a child class to the core class 'Date',
to extend it with the string-generation method `strftime` and with the
conversion methods `new-from-date` and `to-date`.

# AUTHOR

Jean Forget [JFORGET@cpan.org](mailto:JFORGET@cpan.org)

# COPYRIGHT AND LICENSE

Copyright © 2020 Jean Forget

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


## dist_zef-melezhik-Tomtit.md
# Tomtit

Tomtit - Raku Task Runner

# Build Status

![SparkyCI](https://sparky.sparrowhub.io/badge/gh-melezhik-Tomtit?foo=bar)

# Install

```
zef install Tomtit

```

# Quick start

Tomtit is a task runner based on Sparrow6 engine, so just drop a few tasks under *some* folder
and run them as Raku scenarios:

```
mkdir -p tasks/hello

```

`tasks/hello/task.bash`:

```
echo "hello world"

```

`.tomty/hello.raku`:

```
task-run "tasks/hello";

```

You can do *more* then that, [read more](https://github.com/melezhik/Sparrow6/blob/master/documentation/development.md)
about Sparrow6 tasks on Sparrow6 documentation.

# Cli api

```
tom $action|$options $thing

```

Initialize tomtit:

```
tom --init

```

Run scenario:

```
tom $scenario

```

Default action (list of scenarios):

```
tom

```

List available scenarios:

```
tom --list

```

Get help:

```
tom --help

```

Show the last executed scenario:

```
tom --last

```

Clean Tomtit cache:

```
tom --clean

```

Example:

```
tom --list

[scenarios list]
test
build
install

tom test

```

# Create scenarios

Tomtit scenarios are just Raku wrappers for underlying Sparrow6 tasks.

Create a `.tom` directory, to hold all the scenarios:

```
mkdir .tom/
nano .tom/build.raku
nano .tom/test.raku
nano .tom/install.raku

```

And the drop some tasks at *some* folder:

`tasks/build/task.bash`:

```
set -e
make
make test
sudo make install

```

`.tom/build.raku`:

```
task-run "tasks/build";

```

You might want to ignore Tomtit cache which commit files to SCM:

```
git add .tom/
echo .tom/.cache >> .gitignore

```

# Using prebuilt Sparrow6 DSL functions

[Sparrow6 DSL](https://github.com/melezhik/Sparrow6/blob/master/documentation/dsl.md) provides
one with ready to use function for some standard automation tasks:

`.tom/example.raku`:

```

# you can use Sparrow6 DSL functions
# to do many system tasks, like:

# creation of files and directories

file 'passwords.txt', %(
    owner => "root",
    mode => "700",
    content => "super secret"
);

directory '.cache', %(
    owner => "server"
);

# or restarting of services

service-restart "web-app";

# or you can run a specific sparrow plugin
# by using task-run function:

task-run 'my task', 'plugin', %( foo => 'bar' );

# for example, to set git repository,
# use git-base plugin:

task-run "set git", "git-base", %(
    email => 'melezhik@gmail.com',
    name  => 'Alexey Melezhik',
    config_scope => 'local',
    set_credential_cache => 'on'
);

```

# Profiles

Profiles are predefined sets of Tomtit scenarios.
To start using scenarios from profile you say:

```
tom --profile $profile

```

Once the command is executed the profile scenarios get installed to the
base Tomtit directory.

To list available profiles say this:

```
tom --profile

```

To list profiles scenarios say this:

```
tom --list --profile $profile

```

You can install selected scenario from profile by using special notation:

```
tom --profile $profile@$scenario

```

For example to install `commit` scenario from `git` profile:

```
tom --profile git@commit

```

# Portable profiles

Tomtit exposes API to create portable profiles as regular Raku modules.

You should create Raku module in `Tomtit::Profile` namespace with the *our* function `profile-data`,
returning `Hash` with scenarios data.

For example:

```
unit module Tomtit::Profile::Pets:ver<0.0.1>;

our sub profile-data () {

    my %a is Map  = (
        cat   => (slurp %?RESOURCES<cat.raku>.Str),
        dog   => (slurp %?RESOURCES<dog.raku>.Str),
        fish  => (slurp %?RESOURCES<fish.raku>.Str)
    );

}

```

The above module defines [Tomtit::Profile::Pets](https://github.com/melezhik/tomtit-profile-pets) profile with 3 scenarios `cat, dog, fish` installed as module resources:

```
resources/
  cat.raku
  dog.raku
  fish.raku

```

Now we can install it as regular Raku module and use through tom:

```
zef install Tomtit::Profile::Pets

```

Once module is installed we can install related profile. Note that we should replace `::` by `-` (\*) symbols
when referring to profile name.

```
tom --list --profile Tomtit-Profile-Pets

load portable profile Tomtit::Profile::Pets as Raku module ...
[profile scenarios]
Tomtit::Profile::Pets@cat       installed: False
Tomtit::Profile::Pets@dog       installed: False
Tomtit::Profile::Pets@fish      installed: False

tom --profile Tomtit-Profile-Pets

install Tomtit::Profile::Pets@cat ...
install Tomtit::Profile::Pets@dog ...
install Tomtit::Profile::Pets@fish ...

```

(\*) Tomtit require such a mapping so that Bash completion could work correctly.

# Removing scenarios

To remove installed scenario say this:

```
tom --remove $scenario

```

# Edit scenario source code

Use `--edit` to create scenario from the scratch or to edit existed scenario source code:

```
tom --edit $scenario

```

# Getting scenario source code

Use `--cat` command to print out scenario source code:

```
tom --cat $scenario

```

Use `--lines` flag to print out with line numbers.

# Environments

* Tomtit environments are configuration files, written on Raku and technically speaking are plain Raku Hashes
* Environment configuration files should be placed at `.tom/conf` directory:

.tom/env/config.raku:

```
{
    name => "Tomtit",
    who-are-you => "smart bird"

}

```

Run Tomtit.

It will pick the `.tom/env/config.raku` and read configuration from it, variables will be accessible as `config` Hash,
inside Tomtit scenarios:

```
my $name = config<name>;
my $who-are-you = config<who-are-you>;

```

To define *named* configuration ( environment ), simply create `.tom/env/config{$env}.raku` file and refer to it through
`--env=$env` parameter:

```
nano .tom/env/config.prod.raku

tom --env=prod ... other parameters here # will run with production configuration

```

You can run editor for environment configuration by using --edit option:

```
tom --env-edit test    # edit test enviroment configuration

tom --env-edit default # edit default configuration

```

You can activate environment by using `--env-set` parameter:

```
tom --env-set prod    # set prod environment as default
tom --env-set         # to list active (current) environment
tom --env-set default # to set current environment to default

```

To view environment configuration use `--env-cat` command:

```
tom --env-cat $env

```

You print out the list of all environments by using `--env-list` parameters:

```
tom --env-list

```

# Tomtit cli configuration

You can set Tomtit configuration in `~/tom.yaml` file:

```
# list of portable Tomtit profiles,
# will be available through Bash completion

profiles:

  - Tomtit-Foo
  - Tomtit-Bar
  - Tomtit-Bar-Baz

# you can also setup some Tomtit cli options here

options:

  quiet: true

```

# Options

```
--verbose          # run scenario in verbose mode
--quiet,-q         # run scenario in less verbose mode
--color            # color output
--no_index_update  # don't update Sparrow repository index
--dump_task        # dump task code before execution, see SP6_DUMP_TASK_CODE Sparrow documentation

```

Example of `~/tom.yaml` file:

```
options:
  no_index_update: true
  quiet: true

```

# Bash completion

You can install Bash completion for tom cli.

```
tom --completion
source  ~/.tom_completion.sh

```

# Development

```
git clone https://github.com/melezhik/Tomtit.git
zef install --/test .
zef install Tomty
tomty --all # run tests

```

# See also

* [ake](https://github.com/Raku/ake) - a Raku make-a-like inspired by rake

# Author

Alexey Melezhik

# Thanks to

God Who gives me inspiration in my work


## dist_cpan-JNTHN-cro.md
# Cro Build Status

This is part of the Cro libraries for implementing services and distributed
systems in Raku. See the [Cro website](https://cro.services/) for further
information and documentation.


## dist_zef-bduggan-Slang-Mosdef.md
## Slang::Mosdef

All the cool kids are using def to declare methods. Now you can, too.

[![Linux](https://github.com/bduggan/mosdef/actions/workflows/linux.yml/badge.svg)](https://github.com/bduggan/mosdef/actions/workflows/linux.yml)

```
use Slang::Mosdef;

class Foo {
    def bar {
        say 'I am cool too';
    }
    method baz {
        say 'This is not as much fun';
    }
}

```

You can also use lambda for subs!

```
my $yo = lambda { say 'oy' };
$yo();

```

Or λ!

```
my $twice = λ ($x) { $x * 2 };
say $twice(0); # still 0

```

Compute 5 factorial using a Y combinator:

```
say λ ( &f ) {
  λ ( \n ) {
    return f(&f)(n);
  }
}(
  λ ( &g ) {
    λ ( \n ) {
        return n==1 ?? 1 !! n * g(&g)(n-1);
    }
})(5)

```


## real.md
Real

Combined from primary sources listed below.

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

See primary documentation
[in context](/type/DateTime#method_Real)
for **method Real**.

```raku
multi method Real(DateTime:D: --> Instant:D)
```

Converts the invocant to [`Instant`](/type/Instant). The same value can be obtained with the [`Instant`](/type/Instant) method.

Available as of release 2023.02 of the Rakudo compiler.

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

See primary documentation
[in context](/type/Complex#method_Real)
for **method Real**.

```raku
multi method Real(Complex:D: --> Num:D)
multi method Real(Complex:U: --> Num:D)
```

Coerces the invocant to [`Num`](/type/Num). If the imaginary part isn't [approximately](/routine/=~=) zero, coercion [fails](/routine/fail) with [`X::Numeric::Real`](/type/X/Numeric/Real).

The `:D` variant returns the result of that coercion. The `:U` variant issues a warning about using an uninitialized value in numeric context and then returns value `0e0`.

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

See primary documentation
[in context](/type/RatStr#method_Real)
for **method Real**.

```raku
multi method Real(Real:D: --> Rat:D)
multi method Real(Real:U: --> Rat:D)
```

The `:D` variant returns the numeric portion of the invocant. The `:U` variant issues a warning about using an uninitialized value in numeric context and then returns value `0.0`.

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

See primary documentation
[in context](/type/Date#method_Real)
for **method Real**.

```raku
multi method Real(Date:D: --> Int:D)
```

Converts the invocant to [`Int`](/type/Int). The same value can be obtained with the `daycount` method.

Available as of release 2023.02 of the Rakudo compiler.

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

See primary documentation
[in context](/type/NumStr#method_Real)
for **method Real**.

```raku
multi method Real(NumStr:D: --> Num:D)
multi method Real(NumStr:U: --> Num:D)
```

The `:D` variant returns the numeric portion of the invocant. The `:U` variant issues a warning about using an uninitialized value in numeric context and then returns value `0e0`.

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

See primary documentation
[in context](/type/Cool#method_Real)
for **method Real**.

```raku
multi method Real()
```

Coerces the invocant to a [`Numeric`](/type/Numeric) and calls its [`.Real`](/routine/Real) method. [Fails](/routine/fail) if the coercion to a [`Numeric`](/type/Numeric) cannot be done.

```raku
say 1+0i.Real;            # OUTPUT: «1␤»
say 2e1.Real;             # OUTPUT: «20␤»
say 1.3.Real;             # OUTPUT: «1.3␤»
say (-4/3).Real;          # OUTPUT: «-1.333333␤»
say "foo".Real.^name;     # OUTPUT: «Failure␤»
```

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

See primary documentation
[in context](/type/ComplexStr#method_Real)
for **method Real**.

```raku
multi method Real(ComplexStr:D: --> Num:D)
multi method Real(ComplexStr:U: --> Num:D)
```

Coerces the numeric portion of the invocant to [`Num`](/type/Num). If the imaginary part isn't [approximately](/language/operators#infix_≅) zero, coercion [fails](/routine/fail) with [`X::Numeric::Real`](/type/X/Numeric/Real).

The `:D` variant returns the result of that coercion. The `:U` variant issues a warning about using an uninitialized value in numeric context and then returns value `0e0`.

# [In role Enumeration](#___top "go to top of document")[§](#(role_Enumeration)_method_Real "direct link")

See primary documentation
[in context](/type/Enumeration#method_Real)
for **method Real**.

```raku
multi method Real(::?CLASS:D:)
```

Takes a value of an enum and returns it after coercion to [`Real`](/type/Real):

```raku
enum Numbers ( cool => '42', almost-pi => '3.14', sqrt-n-one => 'i' );
say cool.Real;           # OUTPUT: «42␤»
say almost-pi.Real;      # OUTPUT: «3.14␤»
try say sqrt-n-one.Real;
say $!.message if $!;    # OUTPUT: «Cannot convert 0+1i to Real: imaginary part not zero␤»
```

Note that if the value cannot be coerced to [`Real`](/type/Real), an exception will be thrown.

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

See primary documentation
[in context](/type/IntStr#method_Real)
for **method Real**.

```raku
multi method Real(IntStr:D: --> Int:D)
multi method Real(IntStr:U: --> Int:D)
```

The `:D` variant returns the numeric portion of the invocant. The `:U` variant issues a warning about using an uninitialized value in numeric context and then returns value `0`.

# [In role Real](#___top "go to top of document")[§](#(role_Real)_method_Real "direct link")

See primary documentation
[in context](/type/Real#method_Real)
for **method Real**.

```raku
multi method Real(Real:D: --> Real:D)
multi method Real(Real:U: --> Real:D)
```

The `:D` variant simply returns the invocant. The `:U` variant issues a warning about using an uninitialized value in numeric context and then returns `self.new`.


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

# NAME

Netstring - A library for working with netstrings

# SYNOPSIS

```
use Netstring;

say to-netstring("hello world!"); # 12:hello world!,

my $b = Buf.new(0x68,0x65,0x6c,0x6c,0x6f,0x20,0x77,0x6f,0x72,0x6c,0x64,0x21);
say to-netstring($b);             # 12:hello world!,

to-netstring-buf("hello world!");
# returns Buf:0x<31 32 3a 68 65 6c 6c 6f 20 77 6f 72 6c 64 21 2c>

to-netstring-buf($b);
# returns Buf:0x<31 32 3a 68 65 6c 6c 6f 20 77 6f 72 6c 64 21 2c>

```

# DESCRIPTION

Work with netstrings. This currently supports generating netstrings, and parsing a netstring from an [IO::Socket](https://docs.raku.org/type/IO::Socket).

# READING FROM A SOCKET

```
use Netstring;

my $daemon = IO::Socket::INET.new(
  :localhost<localhost>,
  :localport(42),
  :listen
);

while my $client = $daemon.accept() {
    # The client sends "12:hello world!," as a stream of bytes.
    my $rawcontent = read-netstring($client);
    my $strcontent = $rawcontent.decode;

    say "The client said: $strcontent";
    # prints "The client said: hello world!"

    $client.write($strcontent.flip);
    # sends "!dlrow olleh" back to the client.

    $client.close();
}

```

# AUTHOR

Timothy Totten

# COPYRIGHT AND LICENSE

Copyright 2012 - 2016 Timothy Totten

Copyright 2017 - 2022 Raku Community

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


## grep.md
grep

Combined from primary sources listed below.

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

See primary documentation
[in context](/type/Any#method_grep)
for **method grep**.

```raku
method grep(Mu $matcher, :$k, :$kv, :$p, :$v --> Seq)
```

Coerces the invocant to a `list` by applying its [`.list`](/routine/list) method and uses [`List.grep`](/type/List#routine_grep) on it.

For undefined invocants, based on `$matcher` the return value can be either `((Any))` or the empty List.

```raku
my $a;
say $a.grep({ True }); # OUTPUT: «((Any))␤»
say $a.grep({ $_ });   # OUTPUT: «()␤»
```

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

See primary documentation
[in context](/type/HyperSeq#method_grep)
for **method grep**.

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

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

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

```

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

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

See primary documentation
[in context](/type/List#routine_grep)
for **routine grep**.

```raku
sub    grep(Mu $matcher, *@elems, :$k, :$kv, :$p, :$v --> Seq:D)
method grep(List:D:  Mu $matcher, :$k, :$kv, :$p, :$v --> Seq:D)
```

Returns a sequence of elements against which `$matcher` smartmatches. The elements are returned in the order in which they appear in the original list.

Examples:

```raku
say ('hello', 1, 22/7, 42, 'world').grep: Int;              # OUTPUT: «(1 42)␤»
say grep { .Str.chars > 3 }, 'hello', 1, 22/7, 42, 'world'; # OUTPUT: «(hello 3.142857 world)␤»
```

Note that if you want to grep for elements that do not match, you can use a `none`-[`Junction`](/type/Junction):

```raku
say <a b 6 d 8 0>.grep(none Int);           # OUTPUT: «(a b d)␤»
say <a b c d e f>.grep(none /<[aeiou]>/);   # OUTPUT: «(b c d f)␤»
```

Another option to grep for elements that do not match a regex is to use a block:

```raku
say <a b c d e f>.grep({! /<[aeiou]>/})     # OUTPUT: «(b c d f)␤»
```

The reason the example above works is because a regex in Boolean context applies itself to `$_`. In this case, `!` boolifies the `/<[aeiou]>/` regex and negates the result. Smartmatching against a [`Callable`](/type/Callable) (in this case a [`Block`](/type/Block)) returns the value returned from that callable, so the boolified result of a regex is then used to decide whether the current value should be kept in the result of a grep.

The optional named parameters `:k`, `:kv`, `:p`, `:v` provide the same functionality as on slices:

* k

Only return the index values of the matching elements in order.

* kv

Return both the index and matched elements in order.

* p

Return the index and the matched element as a [`Pair`](/type/Pair), in order.

* v

Only return the matched elements (same as not specifying any named parameter at all).

Examples:

```raku
say ('hello', 1, 22/7, 42, 'world').grep: Int, :k;
# OUTPUT: «(1 3)␤»
say grep { .Str.chars > 3 }, :kv, 'hello', 1, 22/7, 42, 'world';
# OUTPUT: «(0 hello 2 3.142857 4 world)␤»
say grep { .Str.chars > 3 }, :p, 'hello', 1, 22/7, 42, 'world';
# OUTPUT: «(0 => hello 2 => 3.142857 4 => world)␤»
```

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

See primary documentation
[in context](/type/Supply#method_grep)
for **method grep**.

```raku
method grep(Supply:D: Mu $test --> Supply:D)
```

Creates a new supply that only emits those values from the original supply that smartmatch against `$test`.

```raku
my $supplier = Supplier.new;
my $all      = $supplier.Supply;
my $ints     = $all.grep(Int);
$ints.tap(&say);
$supplier.emit($_) for 1, 'a string', 3.14159;   # prints only 1
```

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

See primary documentation
[in context](/type/RaceSeq#method_grep)
for **method grep**.

```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.


## packages.md
Packages

Organizing and referencing namespaced program elements

Packages are nested namespaces of named program elements. [Modules](/language/module-packages), classes, grammars, and others are types of packages. Like files in a directory, you can generally refer to named elements with their short-name if they are local, or with the longer name that includes the namespace to disambiguate as long as their scope allows that.

# [Names](#Packages "go to top of document")[§](#Names "direct link")

A package *name* is anything that is a legal part of a variable name (not counting the sigil). This includes:

```raku
class Foo {
    sub zape () { say "zipi" }
    class Bar {
        method baz () { return 'Þor is mighty' }
        our &zape = { "zipi" };
        our $quux = 42;
    }
}

my $foo;                # simple identifiers
say Foo::Bar.baz;       # calling a method; OUTPUT: «Þor is mighty␤»
say Foo::Bar::zape;     # compound identifiers separated by ::; OUTPUT: «zipi␤»
my $bar = 'Bar';
say $Foo::($bar)::quux; # compound identifiers with interpolations; OUTPUT: «42␤»
$42;                    # numeric names
$!;                     # certain punctuation variables

```

`::` is used to separate nested package names.

Packages do not really have an identity; they can be simply part of a module or class name, for instance. They are more similar to namespaces than to modules. A module of the same name will *capture* the identity of a package if it exists.

```raku
package Foo:ver<0> {};
module Foo:ver<1> {};
say Foo.^ver; # OUTPUT: «1␤»

```

The syntax allows the declared package to use a version as well as an *authority* `auth`, but as a matter of fact, it's dismissed; only modules, classes and other higher order type objects have an identity that might include `auth` and `ver`.

```raku
package Foo:ver<0>:auth<bar> {};
say Foo.^auth;
# OUTPUT: «(exit code 1) No such method 'auth' for invocant of type
# 'Perl6::Metamodel::PackageHOW' ...

```

## [Package-qualified names](#Packages "go to top of document")[§](#Package-qualified_names "direct link")

Ordinary package-qualified names look like this: `$Foo::Bar::quux`, which would be the `$quux` variable in package `Foo::Bar`; `Foo::Bar::zape` would represent the `&zape` variable in the same package.

Sometimes it's clearer to keep the sigil with the variable name, so an alternate way to write this is:

```raku
Foo::Bar::<$quux>
```

This does not work with the `Foo«&zape»` variable, since `sub`s, by default, have lexical scope. The name is resolved at compile time because the variable name is a constant. We can access the rest of the variables in `Bar` (as shown in the example above) since classes, by default, have package scope.

If the name part before `::` is null, it means the package is unspecified and must be searched for. Generally this means that an initial `::` following the main sigil is a no-op on names that are known at compile time, though `::()` can also be used to introduce an interpolation. Also, in the absence of another sigil, `::` can serve as its own sigil indicating intentional use of a not-yet-declared package name.

# [Pseudo-packages](#Packages "go to top of document")[§](#Pseudo-packages "direct link")

The following pseudo-package names are reserved at the front of a name:

|  |  |
| --- | --- |
| MY | Symbols in the current lexical scope (aka $?SCOPE) |
| OUR | Symbols in the current package (aka $?PACKAGE) |
| CORE | Outermost lexical scope, definition of standard Raku |
| GLOBAL | Interpreter-wide package symbols, really UNIT::GLOBAL |
| PROCESS | Process-related globals (superglobals). The last place dynamic variable lookup will look. |
| COMPILING | Lexical symbols in the scope being compiled |

The following relative names are also reserved but may be used anywhere in a name:

|  |  |
| --- | --- |
| CALLER | Dynamic symbols in the immediate caller's lexical scope |
| CALLERS | Dynamic symbols in any caller's lexical scope |
| DYNAMIC | Dynamic symbols in my or any caller's lexical scope |
| OUTER | Symbols in the next outer lexical scope |
| OUTERS | Symbols in any outer lexical scope |
| LEXICAL | Dynamic symbols in my or any outer's lexical scope |
| UNIT | Symbols in the outermost lexical scope of compilation unit |
| SETTING | Lexical symbols in the unit's DSL (usually CORE) |
| PARENT | Symbols in this package's parent package (or lexical scope) |
| CLIENT | The nearest CALLER that comes from a different package |

The file's scope is known as `UNIT`, but there are one or more lexical scopes outside of that corresponding to the linguistic setting (often known as the prelude in other cultures). Hence, the `SETTING` scope is equivalent to `UNIT::OUTERS`. For a standard Raku program `SETTING` is the same as `CORE`, but various startup options (such as `-n` or `-p`) can put you into a domain specific language, in which case `CORE` remains the scope of the standard language, while `SETTING` represents the scope defining the DSL that functions as the setting of the current file. When used as a search term in the middle of a name, `SETTING` includes all its outer scopes up to `CORE`. To get *only* the setting's outermost scope, use `UNIT::OUTER` instead.

# [Looking up names](#Packages "go to top of document")[§](#Looking_up_names "direct link")

## [Interpolating into names](#Packages "go to top of document")[§](#Interpolating_into_names "direct link")

You may [interpolate](https://en.wikipedia.org/wiki/String_interpolation) a string into a package or variable name using `::($expr)` where you'd ordinarily put a package or variable name. The string is allowed to contain additional instances of `::`, which will be interpreted as package nesting. You may only interpolate entire names, since the construct starts with `::`, and either ends immediately or is continued with another `::` outside the parentheses. Most symbolic references are done with this notation:

```raku
my $foo = "Foo";
my $bar = "Bar";
my $foobar = "Foo::Bar";
$::($bar)              # lexically-scoped $Bar
$::("MY::$bar")        # lexically-scoped $Bar
$::("OUR::$bar")       # package-scoped $Bar
$::("GLOBAL::$bar")    # global $Bar
$::("PROCESS::$bar")   # process $Bar
$::("PARENT::$bar")    # current package's parent's $Bar
$::($foobar)           # $Foo::Bar
@::($foobar)::baz      # @Foo::Bar::baz
@::($foo)::Bar::baz    # @Foo::Bar::baz
@::($foobar)baz        # ILLEGAL at compile time (no operator baz)
@::($foo)::($bar)::baz # @Foo::Bar::baz

```

An initial `::` doesn't imply global; here as part of the interpolation syntax it doesn't even imply package. After the interpolation of the `::()` component, the indirect name is looked up exactly as if it had been there in the original source code, with priority given first to leading pseudo-package names, then to names in the lexical scope (searching scopes outwards, ending at `CORE`). The current package is searched last.

Use the `MY` pseudopackage to limit the lookup to the current lexical scope, and `OUR` to limit the scopes to the current package scope.

In the same vein, class and method names can be interpolated too:

```raku
role with-method {
    method a-method { return 'in-a-method of ' ~ $?CLASS.^name  };
}

class a-class does with-method {
    method another-method { return 'in-another-method' };
}

class b-class does with-method {};

my $what-class = 'a-class';

say ::($what-class).a-method; # OUTPUT: «in-a-method of a-class␤»
$what-class = 'b-class';
say ::($what-class).a-method; # OUTPUT: «in-a-method of b-class␤»

my $what-method = 'a-method';
say a-class."$what-method"(); # OUTPUT: «in-a-method of a-class␤»
$what-method = 'another-method';
say a-class."$what-method"(); # OUTPUT: «in-another-method␤»
```

## [Direct lookup](#Packages "go to top of document")[§](#Direct_lookup "direct link")

To do direct lookup in a package's symbol table without scanning, treat the package name as a hash:

```raku
Foo::Bar::{'&baz'}  # same as &Foo::Bar::baz
PROCESS::<$IN>      # same as $*IN
Foo::<::Bar><::Baz> # same as Foo::Bar::Baz

```

Unlike `::()` symbolic references, this does not parse the argument for `::`, nor does it initiate a namespace scan from that initial point. In addition, for constant subscripts, it is guaranteed to resolve the symbol at compile time.

You cannot use this kind of direct lookup inside regular expressions, unless you issue a `MONKEY-SEE-NO-EVAL` pragma. The main intention of this measure is to avoid user input being executed externally.

The null pseudo-package is the same search list as an ordinary name search. That is, the following are all identical in meaning:

```raku
$foo
::{'$foo'}
::<$foo>

```

Each of them scans the lexical scopes outward, and then the current package scope (though the package scope is then disallowed when `use strict` is in effect).

## [Package lookup](#Packages "go to top of document")[§](#Package_lookup "direct link")

Subscript the package object itself as a hash object, the key of which is the variable name, including any sigil. The package object can be derived from a type name by use of the `::` postfix:

```raku
MyType::<$foo>

```

## [Class member lookup](#Packages "go to top of document")[§](#Class_member_lookup "direct link")

Methods—including auto-generated methods, such as public attributes' accessors—are stored in the class metaobject and can be looked up through by the [lookup](/routine/lookup) method.

```raku
Str.^lookup('chars')

```

# [Globals](#Packages "go to top of document")[§](#Globals "direct link")

Interpreter globals live in the `GLOBAL` package. The user's program starts in the `GLOBAL` package, so "our" declarations in the mainline code go into that package by default. Process-wide variables live in the `PROCESS` package. Most predefined globals such as `$*UID` and `$*PID` are actually process globals.

# [Programmatic use of modules](#Packages "go to top of document")[§](#Programmatic_use_of_modules "direct link")

It is sometimes useful to be able to programmatically define and use modules. Here is a practical example.

Assume we have a series of modules with the module files in a directory tree like this:

｢text｣ without highlighting

```

```

lib/
    TomtomMaps/
        Example/
            # a directory of example file modules programmatically
            # created from the Tomtom Maps SDK
            A01.rakumod
            #...
            C09.rakumod
            #...

```

```

Module `TomtomMaps::Example::C09` looks like this:

```raku
unit module TomtomMaps::Example::C09;

# ensure you use the 'our' declarator
our sub print-example($fh, # filehandle open for writing
                      :$api-maps-key
) { # do not need to export the sub
    $fh.print: qq:to/HERE/;
    # ... the example html file
    HERE
}

```

We can access and use the subroutines like this:

```raku
use lib 'lib';
my $module-dir = 'TomtomMaps::Example';
my $example    = 'C09';
my $m          = "{$module-dir}::{$example}";

# you must use the runtime 'require', not the compile-time 'use'
require ::($m);

my $fh = open "./example-{$example}.html", :w;
my $api-maps-key = 'ghghfxnnhrgfsWE.mmn';

# execute the subroutine
&::($m)::print-example($fh, :$api-maps-key); # the map's html file is written

$fh.close;

```


## dist_github-zostay-CompUnit-DynamicLib.md
# NAME

CompUnit::DynamicLoader - load modules from temporarily included locations

# SYNOPSIS

```
use CompUnit::DynamicLib;

my @includes = <plugin/lib module/lib other/lib>;

require-from(@includes, "MyPlugin::Module");

use-lib-do @includes, {
    require ModuleX;
    require ModuleY <&something>;
}

```

# DESCRIPTION

**Experimental:** I do not really know if what this module does is a good idea or the best way to do it, but I am trying it out. Please use with caution and let me know if you have any problems.

When searching for compilation units (more commonly referred to as just "modules" or "packages" or "classes") in Perl 6, the VM hunts through all the CompUnit::Repository objects chained in `$*REPO` (this is a more flexible solution to the `@INC` setting using in Perl 5).

Normally, to add a new repository to the list, you would just run:

```
use lib "my-other-lib";
# load your modules here

```

However, perhaps you don't wnat to normally load from a location in your program. You might want to load from a location just long enough to get files out of it and then never see it again. This is a common scenario if your application allows for the use of custom plugin code.

This library makes it possible to add a directory to the list of repositories, load the modules you want, and then remove them so that no more code will be loaded from there:

```
use-lib-do "my-other-lib", {
    # load your modules here
}

```

# EXPORTED ROUTINES

## sub use-lib-do

```
multi sub use-lib-do(@include, &block)
multi sub use-lib-do($include, &block)

```

Given a set of repository specs to `@include` (or `$include`) and a `&block` to run, add those repositories (usually directory names) to `$*REPO`, run the `&block`, and then strip the temporary repositories back out again.

## sub require-from

```
multi sub require-from(@include, $module-name)
multi sub require-from($include, $module-name)

```

In cases where you only need to load a single module, this can be used as a shortcut for:

```
use-lib-do @include, { require ::($module-name) };

```

# AUTHOR & COPYRIGHT

Copyright 2016 Sterling Hanenkamp.

This software is made available under the same terms as Perl 6 itself.


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

# NAME

HTML::Escape - Utility of HTML escaping

# SYNOPSIS

```
use HTML::Escape;

escape-html("<^o^>"); # => '<^o^>'

```

# DESCRIPTION

HTML::Escape provides a function which escapes HTML's special characters. It performs a similar function to PHP's htmlspecialchars.

This module is perl6 port of [HTML::Escape of perl5](https://metacpan.org/pod/HTML::Escape).

# Functions

## `escape-html(Str $raw-str) returns Str`

Escapes HTML's special characters in given string.

# TODO

* Support unescaping function?

# SEE ALSO

[HTML::Escape of perl5](https://metacpan.org/pod/HTML::Escape)

# COPYRIGHT AND LICENSE

```
Copyright 2017- moznion <moznion@gmail.com>

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

```

And original perl5's HTML::Escape is

```
This software is copyright (c) 2012 by Tokuhiro Matsuno E<lt>tokuhirom AAJKLFJEF@ GMAIL COME<gt>.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

```


## dist_zef-antononcube-DSL-Entity-Geographics.md
# DSL::Entity::Geographics

[![MacOS](https://github.com/antononcube/Raku-DSL-Entity-Geographics/actions/workflows/macos.yml/badge.svg)](https://github.com/antononcube/Raku-DSL-Entity-Geographics/actions/workflows/macos.yml)
[![Linux](https://github.com/antononcube/Raku-DSL-Entity-Geographics/actions/workflows/linux.yml/badge.svg)](https://github.com/antononcube/Raku-DSL-Entity-Geographics/actions/workflows/linux.yml)
[![Win64](https://github.com/antononcube/Raku-DSL-Entity-Geographics/actions/workflows/windows.yml/badge.svg)](https://github.com/antononcube/Raku-DSL-Entity-Geographics/actions/workflows/windows.yml)
[![](https://raku.land/zef:antononcube/DSL::Entity::Geographics/badges/version)](https://raku.land/zef:antononcube/DSL::Entity::Geographics)
[![](https://img.shields.io/badge/License-Artistic%202.0-0298c3.svg)](https://opensource.org/licenses/Artistic-2.0)

Raku grammar classes for geographic entities (names.)

This package is closely related, but independent of
[Data::Geographics](https://raku.land/zef:antononcube/Data::Geographics), [AAp5].

## Installation

From [Zef ecosystem](https://raku.land):

```
zef install DSL::Entity::Geographics

```

From GitHub:

```
zef install https://github.com/antononcube/Raku-DSL-Entity-Geographics.git

```

## Examples

### Basic entity name retrieval

Here we show how the entity ID is retrieved using an adjective:

```
use DSL::Entity::Geographics;

ToGeographicEntityCode('Brazilian');

```

```
# "Brazil"

```

### Identifiers

The known cities are have identifier in the form: `<country>.<province>.<city>`.
The names in the identifiers have underscore characters ("\_") instead of spaces.
For example:

```
United_States.Nevada.Las_Vegas

```

**Remark:** Both packages "DSL::Entity::Geographics" and "Data::Geographics" have
the same identifiers.

### City specs

There is a dedicated function for parsing city names together with a state- or country name:

```
entity-city-and-state-name('Chicago, IL')

```

```
# United_States.Illinois.Chicago

```

If the adverb `:exhaustive` (or just `:ex`) is used then all matches for city name in country (like USA)
are returned:

```
.say for entity-city-and-state-name('Atlanta United States'):ex

```

```
# United_States.Missouri.Atlanta
# United_States.Kansas.Atlanta
# United_States.Indiana.Atlanta
# United_States.Michigan.Atlanta
# United_States.Texas.Atlanta
# United_States.Illinois.Atlanta
# United_States.Louisiana.Atlanta
# United_States.Georgia.Atlanta
# United_States.Wisconsin.Atlanta
# United_States.Nebraska.Atlanta

```

A city name without a specified country or state is considered a generic city name if found in the
gazeteer database:

```
say entity-city-and-state-name('Miama');

```

```
#ERROR: Possible misspelling of 'miami' as 'miama'.
# CITYNAME.Miami

```

**Remark:** Misspellings are recognized and allowed:

### Grammar parsing

One of the main motivations for this package is to be able to use known country names and related adjectives
as grammar tokens. For example, in packages like ["DSL::English::FoodPreparationWorkflows"](https://github.com/antononcube/Raku-DSL-English-FoodPreparationWorkflows), [AAp4].

Here are few grammar parsing examples:

```
use DSL::Entity::Geographics::Grammar;

my $pCOMMAND = DSL::Entity::Geographics::Grammar.new;

$pCOMMAND.set-resources(DSL::Entity::Geographics::resource-access-object());

say $pCOMMAND.parse('Argentina', rule => 'geographic-entity-command');

```

```
#ERROR: Possible misspelling of 'argentine' as 'argentina'.
# ｢Argentina｣
#  entity-country-adjective => ｢Argentina｣
#   0 => ｢Argentina｣
#    word-value => ｢Argentina｣

```

```
say $pCOMMAND.parse('United States of America', rule => 'geographic-entity-command');

```

```
# ｢United States of America｣
#  entity-country-name => ｢United States of America｣
#   0 => ｢United States of America｣
#    word-value => ｢United｣
#    word-value => ｢States｣
#    word-value => ｢of｣
#    word-value => ｢America｣

```

Again, misspellings are recognized and allowed:

```
say $pCOMMAND.parse('Indianapolia, Indiana', rule => 'entity-city-and-state-name');

```

```
#ERROR: Possible misspelling of 'indianapolis' as 'indianapolia'.
# ｢Indianapolia, Indiana｣
#  entity-city-name => ｢Indianapolia｣
#   0 => ｢Indianapolia｣
#    word-value => ｢Indianapolia｣
#  entity-state-name => ｢Indiana｣
#   0 => ｢Indiana｣
#    word-value => ｢Indiana｣

```

## References

[AAp1] Anton Antonov,
[DSL::Shared Raku package](https://github.com/antononcube/Raku-DSL-Shared),
(2020),
[GitHub/antononcube](https://github.com/antononcube).

[AAp2] Anton Antonov,
[DSL::Entity::Jobs Raku package](https://github.com/antononcube/Raku-DSL-Entity-Jobs),
(2021),
[GitHub/antononcube](https://github.com/antononcube).

[AAp3] Anton Antonov,
[DSL::Entity::Foods Raku package](https://github.com/antononcube/Raku-DSL-Entity-Foods),
(2021),
[GitHub/antononcube](https://github.com/antononcube).

[AAp4] Anton Antonov,
[DSL::English::FoodPreparationWorkflows Raku package](https://github.com/antononcube/Raku-DSL-English-FoodPreparationWorkflows),
(2021),
[GitHub/antononcube](https://github.com/antononcube).

[AAp5] Anton Antonov,
[Data::Geographics Raku package](https://github.com/antononcube/Raku-Data-Geographics),
(2024),
[GitHub/antononcube](https://github.com/antononcube).


## unshift.md
unshift

Combined from primary sources listed below.

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

See primary documentation
[in context](/type/Any#method_unshift)
for **method unshift**.

```raku
multi method unshift(Any:U: --> Array)
multi method unshift(Any:U: @values --> Array)
```

Initializes `Any` variable as empty [`Array`](/type/Array) and calls [`Array.unshift`](/type/Array#routine_unshift) on it.

```raku
my $a;
say $a.unshift; # OUTPUT: «[]␤»
say $a;         # OUTPUT: «[]␤»
my $b;
say $b.unshift([1,2,3]); # OUTPUT: «[[1 2 3]]␤»
```

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

See primary documentation
[in context](/type/Array#routine_unshift)
for **routine unshift**.

```raku
multi        unshift(Array:D, **@values --> Array:D)
multi method unshift(Array:D: **@values --> Array:D)
```

Adds the `@values` to the start of the array, and returns the modified array. Fails if `@values` is a lazy list.

Example:

```raku
my @foo = <a b c>;
@foo.unshift: 1, 3 ... 11;
say @foo;                   # OUTPUT: «[(1 3 5 7 9 11) a b c]␤»
```

The notes in [the documentation for method push](/type/Array#method_push) apply, regarding how many elements are added to the array.

The [routine prepend](/type/Array#routine_prepend) is the equivalent for adding multiple elements from one list or array.

# [In role Buf](#___top "go to top of document")[§](#(role_Buf)_method_unshift "direct link")

See primary documentation
[in context](/type/Buf#method_unshift)
for **method unshift**.

```raku
method unshift()
```

Inserts elements at the beginning of the buffer.

```raku
my $bú = Buf.new( 1, 1, 2, 3, 5 );
$bú.unshift( 0 );
say $bú.raku; # OUTPUT: «Buf.new(0,1,1,2,3,5)␤»
```

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

See primary documentation
[in context](/type/IterationBuffer#method_unshift)
for **method unshift**.

```raku
method unshift(IterationBuffer:D: Mu \value)
```

Adds the given value at the beginning of the `IterationBuffer` and returns the given value. Available as of the 2021.12 release of the Rakudo compiler.

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

See primary documentation
[in context](/type/Nil#method_unshift)
for **method unshift**.

```raku
method unshift(*@)
```

Warns the user that they tried to unshift onto a `Nil` or derived type object.