## dist_zef-FCO-Red.md
[![Build Status](https://github.com/FCO/Red/workflows/test/badge.svg)](https://github.com/FCO/Red/actions) [![Build Status](https://github.com/FCO/Red/workflows/ecosystem/badge.svg)](https://github.com/FCO/Red/actions) [![SparrowCI](https://ci.sparrowhub.io/project/gh-FCO-Red/badge)](https://ci.sparrowhub.io)

# Red

Take a look at our Documentation: <https://fco.github.io/Red/>

## Red - A **WiP** ORM for Raku

## INSTALL

Install with (you need **rakudo 2018.12-94-g495ac7c00** or **newer**):

```
zef install Red

```

## SYNOPSIS

```
use Red:api<2>;

model Person {...}

model Post is rw {
    has Int         $.id        is serial;
    has Int         $!author-id is referencing( *.id, :model(Person) );
    has Str         $.title     is column{ :unique };
    has Str         $.body      is column;
    has Person      $.author    is relationship{ .author-id };
    has Bool        $.deleted   is column = False;
    has DateTime    $.created   is column .= now;
    has Set         $.tags      is column{
        :type<string>,
        :deflate{ .keys.join: "," },
        :inflate{ set(.split: ",") }
    } = set();
    method delete { $!deleted = True; self.^save }
}

model Person is rw {
    has Int  $.id            is serial;
    has Str  $.name          is column;
    has Post @.posts         is relationship{ .author-id };
    method active-posts { @!posts.grep: not *.deleted }
}

my $*RED-DB = database "SQLite";

Person.^create-table;

```

```
-- Equivalent to the following query:
CREATE TABLE person(
    id integer NOT NULL primary key
    AUTOINCREMENT,
    name varchar(255) NOT NULL
)

```

```
Post.^create-table;

```

```
-- Equivalent to the following query:
CREATE TABLE post(
    id integer NOT NULL primary key AUTOINCREMENT,
    author_id integer NULL references person(id),
    title varchar(255) NOT NULL,
    body varchar(255) NOT NULL,
    deleted integer NOT NULL,
    created varchar(32) NOT NULL,
    tags varchar(255) NOT NULL,
    UNIQUE (title)
)

```

```
my Post $post1 = Post.^load: :42id;

```

```
-- Equivalent to the following query:
SELECT
    post.id,
    post.author_id as "author-id",
    post.title,
    post.body,
    post.deleted,
    post.created,
    post.tags
FROM
    post
WHERE
    post.id = 42

```

```
my Post $post1 = Post.^load: 42;

```

```
-- Equivalent to the following query:
SELECT
    post.id,
    post.author_id as "author-id",
    post.title,
    post.body,
    post.deleted,
    post.created,
    post.tags
FROM
    post
WHERE
    post.id = 42

```

```
my Post $post1 = Post.^load: :title("my title");

```

```
-- Equivalent to the following query:
SELECT
    post.id,
    post.author_id as "author-id",
    post.title,
    post.body,
    post.deleted,
    post.created,
    post.tags
FROM
    post
WHERE
    post.title = ‘my title’

```

```
my $person = Person.^create: :name<Fernando>;

```

```
-- Equivalent to the following query:
INSERT INTO person(
    name
)
VALUES(
    $1
) RETURNING *
-- BIND: ["Fernando"]

```

```
RETURNS:
Person.new(name => "Fernando")

```

```
say $person.posts;

```

```
-- Equivalent to the following query:
SELECT
    post.id,
    post.author_id as "author-id",
    post.title,
    post.body,
    post.deleted,
    post.created,
    post.tags
FROM
    post
WHERE
    post.author_id = ?
-- BIND: [1]

```

```
say Person.new(:2id)
    .active-posts
    .grep: { .created > now }

```

```
-- Equivalent to the following query:
SELECT
    post.id,
    post.author_id as "author-id",
    post.title,
    post.body,
    post.deleted,
    post.created,
    post.tags
FROM
    post
WHERE
    (
       post.author_id = ?
       AND (
           post.deleted == 0
           OR post.deleted IS NULL
       )
    )
    AND post.created > 1554246698.448671
-- BIND: [2]

```

```
my $now = now;
say Person.new(:3id)
    .active-posts
    .grep: { .created > $now }

```

```
-- Equivalent to the following query:
SELECT
    post.id,
    post.author_id as "author-id",
    post.title,
    post.body,
    post.deleted,
    post.created,
    post.tags
FROM
    post
WHERE
    (
       post.author_id = ?
       AND (
           post.deleted == 0
           OR post.deleted IS NULL
       )
    )
    AND post.created > ?
-- BIND: [
--   3,
--   Instant.from-posix(
--       <399441421363/257>,
--       Bool::False
--   )
-- ]

```

```
Person.^create:
    :name<Fernando>,
    :posts[
        {
            :title("My new post"),
            :body("A long post")
        },
    ]
;

```

```
-- Equivalent to the following query:
INSERT INTO person(
    name
)
VALUES(
    ?
) RETURNING *
-- BIND: ["Fernando"]

INSERT INTO post(
    created,
    title,
    author_id,
    tags,
    deleted,
    body
)
VALUES(
    ?,
    ?,
    ?,
    ?,
    ?,
    ?
) RETURNING *
-- BIND: [
--   "2019-04-02T22:55:13.658596+01:00",
--   "My new post",
--   1,
--   "",
--   Bool::False,
--   "A long post"
-- ]

```

```
my $post = Post.^load: :title("My new post");

```

```
-- Equivalent to the following query:
SELECT
    post.id,
    post.author_id as "author-id",
    post.title,
    post.body,
    post.deleted,
    post.created,
    post.tags
FROM
    post
WHERE
    post.title = ‘My new post’
-- BIND: []

```

```
RETURNS:
Post.new(
   title   => "My new post",
   body    => "A long post",
   deleted => 0,
   created => DateTime.new(
       2019,
       4,
       2,
       23,
       7,
       46.677388,
       :timezone(3600)
   ),
   tags    => Set.new("")
)

```

```
say $post.body;

```

```
PRINTS:
A long post

```

```
my $author = $post.author;

```

```
RETURNS:
Person.new(name => "Fernando")

```

```
$author.name = "John Doe";

$author.^save;

```

```
-- Equivalent to the following query:
UPDATE person SET
    name = ‘John Doe’
WHERE id = 1

```

```
$author.posts.create:
    :title("Second post"),
    :body("Another long post");

```

```
-- Equivalent to the following query:
INSERT INTO post(
    title,
    body,
    created,
    tags,
    deleted,
    author_id
)
VALUES(
    ?,
    ?,
    ?,
    ?,
    ?,
    ?
) RETURNING *
-- BIND: [
--   "Second post",
--   "Another long post",
--   "2019-04-02T23:28:09.346442+01:00",
--   "",
--   Bool::False,
--   1
-- ]

```

```
$author.posts.elems;

```

```
-- Equivalent to the following query:
SELECT
    count(*) as "data_1"
FROM
    post
WHERE
    post.author_id = ?
-- BIND: [1]

```

```
RETURNS:
2

```

## DESCRIPTION

Red is a *WiP* ORM for Raku.

### traits

* `is column`
* `is column{}`
* `is id`
* `is id{}`
* `is serial`
* `is referencing{}`
* `is relationship{}`
* `is table<>`
* `is nullable`

### features:

#### relationships

Red will infer relationship data if you use type constraints on your properties.

```
# Single file e.g. Schema.pm6

model Related { ... }

# belongs to
model MyModel {
    has Int     $!related-id is referencing( *.id, :model<Related> );
    has Related $.related    is relationship{ .id };
}

# has one/has many
model Related {
    has Int $.id is serial;
    has MyModel @.my-models is relationship{ .related-id };
}

```

If you want to put your schema into multiple files, you can create an "indirect" relationship, and Red will look up the related models as necessary.

```
# MyModel.pm6
model MyModel {
    has Int     $!related-id is referencing{ :model<Related>, :column<id> };
    has         $.related    is relationship({ .id }, :model<Related>);
}

# Related.pm6
model Related {
    has Int $.id is serial;
    has     @.my-models is relationship({ .related-id }, :model<MyModel>);
}

```

If Red can’t find where your `model` is defined you can override where it looks with `require`:

```
    has Int     $!related-id is referencing{ :model<Related>, :column<id>,
                                             :require<MyApp::Schema::Related> };

```

#### custom table name

```
model MyModel is table<custom_table_name> {}

```

#### not nullable columns by default

Red, by default, has not nullable columns, to change it:

```
#| This makes this model’s columns nullable by default
model MyModel is nullable {
    has Int $.col1 is column;               #= this column is nullable
    has Int $.col2 is column{ :!nullable }; #= this one is not nullable
}

```

#### load object from database

```
MyModel.^load: 42;
MyModel.^load: id => 42;

```

#### save object on the database

```
$object.^save;

```

#### search for a list of object

```
Question.^all.grep: { .answer == 42 }; # returns a result seq

```

#### phasers

* `before-create`
* `after-create`
* `before-update`
* `after-update`
* `before-delete`
* `after-delete`

#### Temporary table

```
model Bla is temp { ... }

```

#### Create table

```
Question.^create-table;
Question.^create-table: :if-not-exists;
Question.^create-table: :unless-exists;

```

#### IN

```
Question.^all.grep: *.answer ⊂ (3.14, 13, 42)

```

#### create

```
Post.^create: :body("bla ble bli blo blu"), :title("qwer");

model Tree {
    has UInt   $!id        is id;
    has Str    $.value     is column;
    has UInt   $!parent-id is referencing{ Tree.id };

    has Tree   $.parent    is relationship{ .parent-id };
    has Tree   @.kids      is relationship{ .parent-id };
}

Tree.^create-table: :if-not-exists;

Tree.^create:
    :value<Bla>,
    :parent{:value<Ble>},
    :kids[
        {:value<Bli>},
        {:value<Blo>},
        {:value<Blu>}
    ]
;

```

## 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_cpan-CTILMES-DB-SQLite.md
# DB::SQLite - SQLite access for Raku

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

This is a reimplementation of Raku bindings for SQLite.

## Basic usage

```
my $s = DB::SQLite.new();  # You can pass in various connection options

```

Execute a query, and get a single value:

```
say $s.query('select 42').value;
# 42

```

Create a table:

```
$s.execute('create table foo (x int, y text)');

```

Insert some values using placeholders:

```
$s.query('insert into foo (x,y) values (?,?)', 1, 'this');

```

Or even fancy placeholders:

```
$s.query('insert into foo (x,y) values ($x,$y)', x => 2, y => 'that');

```

Execute a query returning a row as an array or hash;

```
say $s.query('select * from foo where x = $x', :x(1)).array;
say $s.query('select * from foo where x = $x', :2x).hash;

```

Execute a query returning a bunch of rows as arrays or hashes:

```
.say for $s.query('select * from foo').arrays;
.say for $s.query('select * from foo').hashes;

```

## Connection Information

When you create a **DB::SQLite** object, you can specify a `filename`
option to `.new` for the database to open. If it isn't specified, it
will default to an empty string which causes a private, temporary
on-disk database to be created. This will be useless if you use more
than one connection, since each will get its own database, but maybe
you want that..

If you specify `filename => ':memory'` you will get a private,
temporary, in-memory database. Again, this will not be shared across
connections.

You can also use a `busy-timeout` option to specify in
milliseconds, the amount of sleeping to wait for a locked table to
become available. This defaults to 10000 (10 seconds). Setting to
zero will turn off busy handling.

```
use DB::SQLite;

my $s = DB::SQLite.new(filename => 'this.db', busy-timeout => 50000);

```

You can also pass in additional extended open flags, such as
'readonly':

```
my $s = DB::SQLite.new(filename => 'this.db', :readonly);

```

Depending on your sqlite version, Flags may include: readonly,
readwrite, create, deleteonclose, exclusive, autoproxy, uri, memory,
main\_db, temp\_db, transient\_db, main\_journal, temp\_journal,
subjournal, super\_journal, nomutex, fullmutex, sharedcache,
privatecache, wal, nofollow. Refer to the SQLite docs for more
information on them.

## DB::SQLite::Connection

The main **DB::SQLite** object acts as a factory for connections,
maintaining a cache of connections already created. A new connection
can be requested with the `.db` method, but often this isn't needed.
When you are finished with a connection, you can explicitly return it
to the cache with `.finish`.

You can call `.query()` or `.execute()` on the main **DB::SQLite**
object, but all they really do is allocate a
**DB::SQLite::Connection** (either from the cache, or create a new
one) and call those methods on it, then return the connection to the
cache.

These are equivalent:

```
.say for $s.query('select * from foo').arrays;

```

```
my $db = $s.db;
.say for $db.query('select * from foo').arrays;
$db.finish;

```

The connection object also has some extra methods for separately
preparing and executing the query:

```
my $db = $s.db;
my $sth = $db.prepare('insert into foo (x,y) values (?,?)');
$sth.execute(1, 'this');
$sth.execute(2, 'that');
$db.finish;

```

You can also call `.finish()` on the statement:

```
my $sth = $s.db.prepare('insert into foo (x,y) values (?,?)');
$sth.execute(1, 'this');
$sth.execute(2, 'that');
$sth.finish;

```

The statement will finish the associated connection, returning it to
the cache. Yet another way to do it is to pass `:finish` in to the
execute.

```
my $sth = $s.db.prepare('insert into foo (x,y) values (?,?)');
$sth.execute(1, 'this');
$sth.execute(2, 'that', :finish);

```

And finally, a cool Perl 6ish way is the `will` trait to install a
Phaser directly on the variable:

```
{
    my $sth will leave { .finish } = $s.db.prepare('insert into foo (x,y) values (?,?)');
    $sth.execute(1, 'this');
    $sth.execute(2, 'that');
}

```

Calling `.prepare()` on the **DB::SQLite::Connection** prepares and
returns a **DB::SQLite::Statement** that can then be `.execute()`ed.
The prepared statement is also retained in a cache with the
connection. If the same statement is prepared again on the same
connection, the cached object will be returned instead of
re-preparing. If you don't want it to be cached, you can pass in the
`:nocache` option.

```
my $sth = $s.db.prepare('insert into foo (x,y) values (?,?)', :nocache);
$sth.execute(1, 'this');
$sth.execute(2, 'that', :finish);

```

You must still take care to call `.finish()` to return the connection
to the connection cache so it will get reused. (Or take care NOT to
call `.finish()` if you don't want the connection to be reused,
possibly in another thread.)

For the main object, or the connection object, `.execute()` is used
instead of `.query()` under two conditions:

1. You don't need placeholders/arguments.
2. You don't want the results.

As a special added bonus you can execute multiple statements separated
by semi-colons in one shot:

```
$s.execute(q:to/END/);
create table foo
(
   x int,
   y text
);
insert into foo (x,y) values (1, 'this');
insert into foo (x,y) values (2, 'that');
END

```

## Transactions

The database connection object can also manage transactions with the
`.begin`, `.commit`, and `.rollback` methods:

```
my $db = $s.db;
my $sth = $db.prepare('insert into foo (x,y) values (?,?)');
$db.begin;
$sth.execute(1, 'this');
$sth.execute(2, 'that');
$db.commit;
$db.finish;

```

The `begin`/`commit` ensure that the statements between them happen
atomically, either all or none.

Transactions can also dramatically improve performance for some
actions, such as performing thousands of inserts/deletes/updates since
the indexes for the affected table can be updated in bulk once for the
entire transaction.

If you `.finish` the database prior to a `.commit`, an uncommitted
transaction will automatically be rolled back.

As a convenience, `.commit` also returns the database object, so you
can just `$db.commit.finish`.

## Placeholders and Binding

SQLite parameters can take several different forms:

* ?
* ?*NNN*
* :*AAA*
* $*AAA*
* @*AAA*

Where *NNN* is an integer value, and *AAA* is an identifier. When
calling execute, the numbered binds are bound starting with 1 from the
arguments to `.execute` (or `.query`):

```
my $sth = $s.db.prepare('select ?1, ?2, ?3');
say $sth.execute(1,2,3).array;
$sth.finish;

```

The named binds with $*AAA* placeholders are bound with named
parameter pairs:

```
my $sth = $s.db.prepare('select $x, $y, $z');
say $sth.execute(:x(1), :y(2), :z(3)).array;
say $sth.execute(x => 1, y => 2, z => 3).array; # same thing
$sth.finish;

```

Binding the other placeholders is a little more complicated. They
must be bound explicitly prior to calling `.execute()` (This will work
with numbered placeholders too.):

```
my $sth = $s.db.prepare('select :x, $y, @z');
$sth.bind(':x', 1)
$sth.bind('$y', 2)
$sth.bind('@z', 3)
$sth.execute();
$sth.finish;

```

You don't have to bind every placeholder. If you leave one out, it
just gets a `NULL`. If you `.execute` multiple times with the same
statement, it will use whatever bindings are in place from previous
executions. Since by default, statements get cached and re-used, the
safest approach is always to bind every placeholder, even ones you
want to be `NULL`. (Bind with an undefined type, such as `Any` for
`NULL`).

You can even mix and match numbered and named placeholders if you want
to (and are careful).

## Results

Calling `.query()` on a **DB::SQLite** or **DB::SQLite::Connection**,
or calling `.execute()` on a **DB::SQLite::Statement** with an SQL
SELECT or something that returns data, a `DB::SQLite::Result` object
will be returned.

The query results can be consumed from that object with the following
methods:

* `.value` - a single scalar result
* `.array` - a single array of results from one row
* `.hash` - a single hash of results from one row
* `.arrays` - a sequence of arrays of results from all rows
* `.hashes` - a sequence of hashes of results from all rows

If the query isn't a select or otherwise doesn't return data, such as
an INSERT, UPDATE, or DELETE, it will return the number of rows
affected.

## Exceptions

All database errors, including broken SQL queries, are thrown as exceptions.

## Acknowledgements

Inspiration taken from the existing Raku
[DBIish](https://github.com/raku-community-modules/DBIish) module as
well as the Perl 5 [Mojo::Pg](http://mojolicious.org/perldoc/Mojo/Pg)
from the Mojolicious project.

Thanks to hythm7 for contributing to the open flags capability.

## License

Portions thanks to DBIish:

Copyright © 2009-2016, the DBIish contributors All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
  notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
  notice, this list of conditions and the following disclaimer in the
  documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


## dist_cpan-KAIEPI-Net-LibIDN2.md
[![Build Status](https://travis-ci.org/Kaiepi/p6-Net-LibIDN2.svg?branch=master)](https://travis-ci.org/Kaiepi/p6-Net-LibIDN2)

# NAME

Net::LibIDN2 - Perl 6 bindings for GNU LibIDN2

# SYNOPSIS

```
    use Net::LibIDN2;

    my $idn = Net::LibIDN2.new;

    my Int $code;
    my $ulabel = "m\xFC\xDFli";
    my $alabel = $idn.lookup_u8($ulabel, IDN2_NFC_INPUT, $code);
    say "$alabel $code"; # xn--mli-5ka8l 0

    my $result = $idn.register_u8($ulabel, $alabel, IDN2_NFC_INPUT, $code);
    say "$result $code"; # xn--mli-5ka8l 0
    say $idn.strerror($code);      # success
    say $idn.strerror_name($code); # IDN2_OK

```

# DESCRIPTION

Net::LibIDN2 is a Perl 6 wrapper for the GNU LibIDN2 library.

# METHODS

* **Net::LibIDN2.check\_version**(--> Version)
* **Net::LibIDN2.check\_version**(Str *$version* --> Version)
* **Net::LibIDN2.check\_version**(Version *$version* --> Version)

Compares `$version` against the version of LibIDN2 installed and returns either an empty string if `$version` is greater than the version installed, or `IDN2_VERSION` otherwise.

* **Net::LibIDN2.strerror**(Int *$errno* --> Str)

Returns the error represented by `$errno` in human readable form.

* **Net::LibIDN2.strerror\_name**(Int *$errno* --> Str)

Returns the internal error name of `$errno`.

* **Net::LibIDN2.to\_ascii\_8z**(Str *$input* --> Str)
* **Net::LibIDN2.to\_ascii\_8z**(Str *$input*, Int *$flags* --> Str)
* **Net::LibIDN2.to\_ascii\_8z**(Str *$input*, Int *$flags*, Int *$code* is rw --> Str)

Converts a UTF8 encoded string `$input` to ASCII and returns the output. `$code`, if provided, is assigned to `IDN2_OK` on success, or another error code otherwise. Requires LibIDN2 v2.0.0 or greater.

* **Net::LibIDN2.to\_unicode\_8z8z**(Str *$input* --> Str)
* **Net::LibIDN2.to\_unicode\_8z8z**(Str *$input*, Int *$flags* --> Str)
* **Net::LibIDN2.to\_unicode\_8z8z**(Str *$input*, Int *$flags*, Int *$code* is rw --> Str)

Converts an ACE encoded domain name `$input` to UTF8 and returns the output. `$code`, if provided, is assigned to `IDN2_OK` on success, or another error code otherwise. Requires LibIDN v2.0.0 or greater.

* **Net::LibIDN2.lookup\_u8**(Str *$input* --> Str)
* **Net::LibIDN2.lookup\_u8**(Str *$input*, Int *$flags* --> Str)
* **Net::LibIDN2.lookup\_u8**(Str *$input*, Int *$flags*, Int *$code* is rw --> Str)

Performs an IDNA2008 lookup string conversion on `$input`. See RFC 5891, section 5. `$input` must be a UTF8 encoded string in NFC form if no `IDN2_NFC_INPUT` flag is passed.

* **Net::LibIDN2.register\_u8**(Str *$uinput*, Str *$ainput* --> Str)
* **Net::LibIDN2.register\_u8**(Str *$uinput*, Str *$ainput*, Int *$flags* --> Str)
* **Net::LibIDN2.register\_u8**(Str *$uinput*, Str *$ainput*, Int *$flags*, Int *$code* is rw --> Str)

Performs an IDNA2008 register string conversion on `$uinput` and `$ainput`. See RFC 5891, section 4. `$uinput` must be a UTF8 encoded string in NFC form if no `IDN2_NFC_INPUT` flag is passed. `$ainput` must be an ACE encoded string.

# CONSTANTS

* Int **IDN2\_LABEL\_MAX\_LENGTH**

The maximum label length.

* Int **IDN2\_DOMAIN\_MAX\_LENGTH**

The maximum domain name length.

## VERSIONING

* Str **IDN2\_VERSION**

The version of LibIDN2 installed.

* Int **IDN2\_VERSION\_NUMBER**

The version of LibIDN2 installed represented as a 32 bit integer. The first pair of bits represents the major version, the second represents the minor version, and the last 4 represent the patch version.

* Int **IDN2\_VERSION\_MAJOR**

The major version of LibIDN2 installed.

* Int **IDN2\_VERSION\_MINOR**

The minor version of LidIDN2 installed.

* Int **IDN2\_VERSION\_PATCH**

The patch version of LibIDN2 installed.

## FLAGS

* Int **IDN2\_NFC\_INPUT**

Normalize the input string using the NFC format.

* Int **IDN2\_ALABEL\_ROUNDTRIP**

Perform optional IDNA2008 lookup roundtrip check.

* Int **IDN2\_TRANSITIONAL**

Perform Unicode TR46 transitional processing.

* Int **IDN2\_NONTRANSITIONAL**

Perform Unicode TR46 non-transitional processing.

## ERRORS

* Int **IDN2\_OK**

Success.

* Int **IDN2\_MALLOC**

Memory allocation failure.

* Int **IDN2\_NO\_CODESET**

Failed to determine a string's encoding.

* Int **IDN2\_ICONV\_FAIL**

Failed to transcode a string to UTF8.

* Int **IDN2\_ENCODING\_ERROR**

Unicode data encoding error.

* Int **IDN2\_NFC**

Failed to normalize a string.

* Int **IDN2\_PUNYCODE\_BAD\_INPUT**

Invalid input to Punycode.

* Int **IDN2\_PUNYCODE\_BIG\_OUTPUT**

Punycode output buffer is too small.

* Int **IDN2\_PUNYCODE\_OVERFLOW**

Punycode conversion would overflow.

* Int **IDN2\_TOO\_BIG\_DOMAIN**

Domain is larger than `IDN2_DOMAIN_MAX_LENGTH`.

* Int **IDN2\_TOO\_BIG\_LABEL**

Label is larger than `IDN2_LABEL_MAX_LENGTH`.

* Int **IDN2\_INVALID\_ALABEL**

Invalid A-label.

* Int **IDN2\_UALABEL\_MISMATCH**

Given U-label and A-label do not match.

* Int **IDN2\_INVALID\_FLAGS**

Invalid combination of flags.

* Int **IDN2\_NOT\_NFC**

String is not normalized in NFC format.

* Int **IDN2\_2HYPHEN**

String has forbidden two hyphens.

* Int **IDN2\_HYPHEN\_STARTEND**

String has forbidden start/end hyphen.

* Int **IDN2\_LEADING\_COMBINING**

String has forbidden leading combining character.

* Int **IDN2\_DISALLOWED**

String has disallowed character.

* Int **IDN2\_CONTEXTJ**

String has forbidden context-j character.

* Int **IDN2\_CONTEXTJ\_NO\_RULE**

String has context-j character without any rull.

* Int **IDN2\_CONTEXTO**

String has forbidden context-o character.

* Int **IDN2\_CONTEXTO\_NO\_RULE**

String has context-o character without any rull.

* Int **IDN2\_UNASSIGNED**

String has forbidden unassigned character.

* Int **IDN2\_BIDI**

String has forbidden bi-directional properties.

* Int **IDN2\_DOT\_IN\_LABEL**

Label has forbidden dot (TR46).

* Int **IDN2\_INVALID\_TRANSITIONAL**

Label has a character forbidden in transitional mode (TR46).

* Int **IDN2\_INVALID\_NONTRANSITIONAL**

Label has a character forbidden in non-transitional mode (TR46).

# AUTHOR

Ben Davies (kaiepi)

# COPYRIGHT AND LICENSE

Copyright 2017 Ben Davies

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


## dist_zef-FRITH-Math-Libgsl-Wavelet.md
[![Actions Status](https://github.com/frithnanth/raku-Math-Libgsl-Wavelet/actions/workflows/test.yml/badge.svg)](https://github.com/frithnanth/raku-Math-Libgsl-Wavelet/actions)

![Original data](examples/ecg.png) ![Filtered data](examples/ecg.processed.png)

# NAME

Math::Libgsl::Wavelet - An interface to libgsl, the Gnu Scientific Library - Wavelet Transform

# SYNOPSIS

```
use Math::Libgsl::Wavelet;
use Math::Libgsl::Constants;

constant \N    = 256;
constant \kind =   4;

my @data;
for ^N X ^N -> ($i, $j) {
  @data[$i * N + $j] = ($i * N + $j).Num / (N * N);
}

my Math::Libgsl::Wavelet $w .= new: DAUBECHIES, kind;
my @fdata = $w.forward2d(@data);

```

# DESCRIPTION

Math::Libgsl::Wavelet is an interface to the Wavelet Transform functions of libgsl, the Gnu Scientific Library.

### new(UInt:D $type!, UInt:D $variant!)

### new(UInt:D :$type!, UInt:D :$variant!)

The constructor accepts two simple or named arguments: the type of wavelet function and the specific member of the wavelet family.

The available wavelet functions are:

* **DAUBECHIES**
* **DAUBECHIES\_CENTERED**
* **HAAR**
* **HAAR\_CENTERED**
* **BSPLINE**
* **BSPLINE\_CENTERED**

There are two methods for dealing with 1D transforms (direct and inverse):

### forward1d(@data, UInt:D $stride where { $\_ < @data.elems / 2 } = 1, UInt:D $size where { is-powerof2($\_) } = @data.elems --> List)

Forward 1D transform.

The **@data** array is the only mandatory argument. The array may be larger than the set of values that one wants to transform; in that case the **$stride** and **$size** arguments define the set of values that will be transformed.

### inverse1d(@data, UInt:D $stride where { $\_ < @data.elems / 2 } = 1, UInt:D $size where { is-powerof2($\_) } = @data.elems --> List)

Inverse 1D transform.

The **@data** array is the only mandatory argument. The array may be larger than the set of values that one wants to transform; in that case the **$stride** and **$size** arguments define the set of values that will be transformed.

### forward2d(@data!, UInt:D $dim? where { is-powerof2($dim) } = sqrt(@data.elems).UInt, UInt:D $tda? where { $\_ ≥ $dim } = $dim, :$nonstandard --> List)

### forward2d(Math::Libgsl::Matrix $data! where { $data.matrix.size1 == $data.matrix.size2 && is-powerof2($data.matrix.size1) }, :$nonstandard --> Math::Libgsl::Matrix)

Forward 2D transform.

There are two forms of this method: one accepts an array as its first argument, the other works on a Math::Libgsl::Matrix object.

The first form takes an array **@data** which represents a square matrix that must have a number of elements which is a power of 2. The @data array may contain more values than those one wants to transform; in this case the **$size** argument is the dimension of the (square) matrix to be processed and **$tda** is the physical row length.

The second form accepts a square Math::Libgsl::Matrix object whose sizes are powers of 2.

Both forms allow for a named argument **:$nonstandard**, which selects the non-standard form of the computation as detailed in the C library documentation.

### inverse2d(@data!, UInt:D $dim? where { is-powerof2($dim) } = sqrt(@data.elems).UInt, UInt:D $tda? where { $\_ ≥ $dim } = $dim, :$nonstandard --> List)

### inverse2d(Math::Libgsl::Matrix $data! where { $data.matrix.size1 == $data.matrix.size2 && is-powerof2($data.matrix.size1) }, :$nonstandard --> Math::Libgsl::Matrix)

Inverse 2D transform.

There are two forms of this method: one accepts an array as its first argument, the other works on a Math::Libgsl::Matrix object.

The first form takes an array **@data** which represents a square matrix that must have a number of elements which is a power of 2. The @data array may contain more values than those one wants to transform; in this case the **$size** argument is the dimension of the (square) matrix to be processed and **$tda** is the physical row length.

The second form accepts a square Math::Libgsl::Matrix object whose sizes are powers of 2.

Both forms allow for a named argument **:$nonstandard**, which selects the non-standard form of the computation as detailed in the C library documentation.

# C Library Documentation

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

# Prerequisites

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

## Debian Linux and Ubuntu 20.04+

```
sudo apt install libgsl23 libgsl-dev libgslcblas0

```

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

## Ubuntu 18.04

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

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

# Installation

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

```
$ zef install Math::Libgsl::Wavelet

```

# AUTHOR

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

# COPYRIGHT AND LICENSE

Copyright 2022 Fernando Santagata

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


## dist_zef-melezhik-Tomty.md
# Tomty

Tomty - Raku Test Framework.

# Install

```
zef install Tomty

```

# Build Status

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

# Quick start

```
tomty --edit test-01

bash "echo Hello World"

tomty --edit test-02

bash "echo Upps && exit 1";

tomty --edit test-03

bash "echo Hello Again!";

tomty --all # Run all tests and make reports

[1/3] / [test-01] .......  2 sec. OK
[2/3] / [test-02] .......  3 sec. FAIL
[3/3] / [test-03] .......  3 sec. OK
=========================================
)=: (2) tests passed / (1) failed

# save tests to Git

echo ".tomty/.cache" >> .gitignore

git add .tomty

```

# Guide

## Writing tests

Tomty test is just a Raku scenario:

```
tomty --edit test-meta6-file-exist

#!raku

bash "test -f META6.json"

```

You can write more advanced tests, for example:

```
# Check if raku.org is accessible

tomty --edit test-raku-org-alive

#!raku

http-ok("https://raku.org");

# Check if META6.json file is a valid json

tomty --edit test-meta6-is-valid-json

#!raku

task-run "meta6 is a valid json", "json-lint";

```

Check out [Sparrow6 DSL](https://github.com/melezhik/Sparrow6#sparrow6-dsl) on what you can use writing your tests.

## Running tests

* To run all test just say `tomty --all`

It will find all the tests and run them in sequence.

* To run single test just say `tomty $test`

For example:

```
tomty test-meta6-is-valid-json

```

## Examining tests

To list all the tests just say `tomty --list`

This command will list all tests.

## Managing tests

### Removing test

To remove test use `--remove` option:

```
tomty --remove $test

```

### Edit test source code

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

```
tomty --edit $test

```

### Getting test source code

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

```
tomtit --cat $test

```

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

# Environments

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

`.tomty/env/config.raku`:

```
{
    dbname => "products",
    dbhost => "localhost"
}

```

When tomty runs it picks the `.tomty/env/config.raku` and read configuration from it
variables will be accessible as `config` Hash, inside Tomty scenarios:

```
my $dbname = config<dbname>;
my $dbhost = config<dbhost>;

```

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

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

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

```

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

```
tomty --env-edit test    # edit test environment configuration

tomty --env-edit default # edit default configuration

```

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

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

```

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

```
tomty --env-cat $env

```

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

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

```
tomty --env-list

```

## Macros

Tomty macros allow to pre-process test scenarios. To embed macros use `=begin tomty` .. `=end tomty` syntax:

```
=begin tomty
%(
    tag => "slow"
)
=end tomty

```

Macros could be any Raku code, returning `Hash`. The example above set tag=`slow` for slow running tests,
you can skip test execution by using `--skip` option:

```
tomty --skip=slow

```

See also `tags filtering`.

Tags could be multiple as well:

```
=begin tomty
%(
    tag => [ "flaky", "slow" ]
)
=end tomty

```

## Tags filtering

Tags filtering allows to run subsets of scenarios using tags as criteria.

### Logical OR

By default logical OR is implied when using comma:

Examples:

```
tomty --skip=slow,windows # skip slow OR windows tests

tomty --only=frontend,backend # only frontend OR backend test

```

### Logical AND

Use `+` to mimic logical AND:

```
tomty --only=database+mysql # execute only mysql database tests

```

`--skip` and `--only` could be combined to get more sophisticated scenarios:

```
tomty --only=database+mysql,skip=window # execute only mysql database tests BUT not for windows OS system

```

## List tags

One can list available tags by:

```
tomty --list --tags

```

You can combine `--tags` with `--only` or `--skip` options to *list* tagged tests.

Examples:

```
tomty --tags --only=foo  # list tests tagged by `foo`

tomty --tags --only=foo+bar  # list tests tagged by `foo` AND `bar`

tomty --tags --only=foo,bar  # list tests tagged by `foo` OR `bar`

```

## Filter untagged scenarios

Use special `untagged` keyword to filter untagged scenarios:

```
tomty --tags --only=untagged  # list all untagged tests
tomty --only=untagged         # run all untagged tests
tomty --skip=untagged         # run all but untagged tests

```

## Profiles

Tomty profile sets command line arguments for a named profile:

```
cat .tomty/profile

```

```
%(
    default => %(
        skip => "broken"
    )
)

```

One can override following command line arguments through a profile:

* `skip`
* `only`
* `env`
* `no-index-update`

In the future more arguments will be supported.

A `default` profile sets default command line arguments when `tomty` cli run.

To add more profiles just add more Hash keys and define proper settings:

```
%(
    default => %(
        skip => "broken"
    ),
    development => %(
        only => "new-bugs"
    )
)

```

To chose profile use `--profile` option:

```
tomty --profile development

```

## Bash completion

Tomty comes with nice Bash completion to easy cli usage, use `--completion` option to install completion:

```
tomty --completion

```

And then `source ~/.tomty_completion.sh` to activate one.

# Tomty cli

## Options

* `--all|-a`

Run all tests

* `--show-failed`

Show failed tests

* `--verbose`

Runs tests in verbose mode, print more details about every test

* `--no-index-update`

Don't update Sparrow repository index

* `--dump-task`

Dump task code before execution, see SP6\_DUMP\_TASK\_CODE Sparrow documentation

* `--color`

Run in color mode

* `--list`

List tests/tags

To list test only:

```
tomty --list

```

To lists tags only:

```
tomty --list --tags

```

* `--noheader`

Omit header when list tests. Allow to edit tests one by one:

```
for i in $(tomty --noheader); do tomty --edit $i; done

```

* `--edit|--cat|--remove`

Edit, dump, remove test

* `--env-edit|--env-list|--env-set`

Edit, list, set environment

* `--completion`

Install Tomty Bash completion

* `--log`

Get log for given test run, useful when running in all tests mode:

```
tomty -all

tomty --log test-01

```

* `--skip` | `--only`

Set tags filters.

Skip tests tagged as `slow`

```
tomty --skip=slow

```

Only run tests tagged as `linux`

```
tomty --only=linux

```

See also `tags filtering` for more details on tag filtering.

* `--tags`

Show available tags:

```
tomty --list --tags # list all tags

```

You can combine `--tags` with `--only` or `--skip` options:

```
tomty --tags --only=foo+bar  # list tests tagged by `foo` AND `bar`

```

# Environment variables

* `TOMTY_DEBUG`

Use it when debugging Tomty itself:

```
TOMTY_DEBUG=1 tomty --all

```

# See also

* [Sparrow6](https://github.com/melezhik/Sparrow6)
* [Tomtit](https://github.com/melezhik/Tomtit)

# Author

Alexey Melezhik

# Thanks to

God, as my inspiration


## dist_cpan-SOFTMOTH-Text-ShellWords.md
# NAME

Text::ShellWords - Split a string into words like a command-line shell

# SYNOPSIS

```
use Text::ShellWords;

my $input = Q{printf "%s\n" 1 "2 hello" '3 world' 4\ .};
my @output = run(:out, shell-words $input).out.lines(:close);
.put for @output;       # OUTPUT: «1␤2 hello␤3 world␤4 .␤»

```

# DESCRIPTION

Text::ShellWords provides routines to split a string into words, respecting the Unix Bourne Shell (`/bin/sh`) quoting rules. From the `bash` manual page:

* There are three quoting mechanisms: the escape character, single quotes, and double quotes.

  A non-quoted backslash (`\`) is the escape character. It preserves the literal value of the next character that follows, with the exception of *newline*. If a `\`*newline* pair appears, and the backslash is not itself quoted, the `\`*newline* is treated as a line continuation (that is, it is removed from the input stream and effectively ignored).

  Enclosing characters in single quotes preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash.

  Enclosing characters in double quotes preserves the literal value of all characters within the quotes, with the exception of `\`. The backslash retains its special meaning only when followed by one of the following characters: `"`, `\`, or *newline*. A double quote may be quoted within double quotes by preceding it with a backslash.
* Unlike the Bourne Shell, the characters `$`, ```, and `!` have no special meaning to this module.

## class Text::ShellWords::Grammar

Parsing grammar for a shell-input string

## class Text::ShellWords::WordFailure

Error indicator for an incomplete parse

### Incomplete parsing

When the input string is malformed, or intended to continue on another line, the last word is made a `WordFailure` object, rather than a `Str`. This object behaves just like any `Failure`, but it stringifies to the final piece of input text if it has been `handled` (by testing if it is `True` or `defined`).

```
my @words = shell-words 'hello, "world';
put @words[0];      # OUTPUT «hello,␤»
try put @words[1];  # OUTPUT «»
put $!.message;     # OUTPUT «Input is malformed or incomplete, ends with '"world'␤»
# Now that it's been handled, it can used as a Str
put @words[1];      # OUTPUT «"world␤»
# But it is still a Failure
say @words[1].^name if not @words[1];   # OUTPUT: «Text::ShellWords::WordFailure␤»

```

## class Text::ShellWords::Actions

Actions class for C<.parse>. Use C<.new(:keep)> to keep quoting characters in the made words

## shell-words

### sub shell-words

```
sub shell-words(
    Cool:D $input,
    Bool :$keep = Bool::False
) returns Mu

```

Split a string into its shell-quoted words. If C is True, the quote characters are preserved in the returned words. By default they are removed.

# SEE ALSO

This module is inspired by, but has different behavior than, Perl's [Text::ParseWords](https://metacpan.org/pod/Text::ParseWords) and [Text::Shellwords](https://metacpan.org/pod/Text::Shellwords).

The [Bash manual page](https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Quoting) describes the three quoting mechanisms copied by this module.

# AUTHOR

Tim Siegel [siegeltr@gmail.com](mailto:siegeltr@gmail.com)

# COPYRIGHT AND LICENSE

Copyright 2020 Tim Siegel

This library is free software; you can redistribute and modify it under the [Artistic License 2.0](http://www.perlfoundation.org/artistic_license_2_0).


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

# NAME Smooth::Numbers

Given a list of prime factors, return an iterator which will produce numbers that are "smooth" to those factors.

# SYNOPSIS

```
use Smooth::Numbers;

my $Hammings = smooth-numbers(2,3,5);

put $Hammings[^20]; # 1 2 3 4 5 6 8 9 10 12 15 16 18 20 24 25 27 30 32 36

```

# DESCRIPTION

Smooth numbers are defined as "numbers that are products of small prime factors."

Hamming numbers, which are the numbers that are products of 2, 3, 5, is the classic example.

The first ten Hamming numbers ( 2,3,5 smooth numbers ) are:

```
1  ( 2⁰ * 3⁰ * 5⁰ )
2  ( 2¹ * 3⁰ * 5⁰ )
3  ( 2⁰ * 3¹ * 5⁰ )
4  ( 2² * 3⁰ * 5⁰ )
5  ( 2⁰ * 3⁰ * 5¹ )
6  ( 2¹ * 3¹ * 5⁰ )
8  ( 2³ * 3⁰ * 5⁰ )
9  ( 2⁰ * 3² * 5⁰ )
10 ( 2¹ * 3⁰ * 5¹ )
12 ( 2² * 3¹ * 5⁰ )

```

Smooth numbers are easy to conceptualize but can be challenging to generate in order. This module provides a simple routine to overcome that.

Exports a single subroutine:

```
sub smooth-numbers(*@factors)

```

Takes a list or array of factors and returns an iterator that generates an ordered sequence of numbers that are smooth to those factors.

The factors need not be in any order, and need not be prime. Smooth numbers traditionally are thought of as products of only prime factors, but if you want, for instance, the products of powers of 4 and 9, this module will oblige.

```
put smooth-numbers(4,9)[^15];

# 1 4 9 16 36 64 81 144 256 324 576 729 1024 1296 2304

```

For that matter, there is no constraint that the "factors" need even be integers.

```
put smooth-numbers(1.5,2.5)[^10];

# 1 1.5 2.25 2.5 3.375 3.75 5.0625 5.625 6.25 7.59375

```

There *are* a few constraints:

* there must be at least one passed factor.
* the passed parameters must all be numeric. (Can't exponentiate strings).
* the factors must all be greater than or equal to 1 (or the sequence would be non-ascending).

Note that if *any* of the factors is equal to 1, the sequence will return an infinite series of 1s. Should be obvious why if you think about it.

# AUTHOR

2019 Steve Schulze aka thundergnat

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

# LICENSE

Licensed under The Artistic 2.0; see LICENSE.


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

# NAME

Digest::MurmurHash3 - MurmurHash3 implementation for Perl 6

# SYNOPSIS

```
use Digest::MurmurHash3;

my Int $uint32 = murmurhash3_32($key, $seed);

my Buf $hex8   = murmurhash3_32_hex($key, $seed);

my Int @uint32 = murmurhash3_128($key, $seed);

my Buf $hex32  = murmurhash3_128_hex($key, $seed);

```

# DESCRIPTION

Digest::MurmurHash3 is a [MurmurHash3](https://github.com/aappleby/smhasher) hashing algorithm implementation.

# METHODS

## murmurhash3\_32(Str $key, uint32 $seed) returns Int

Calculates 32-bit hash, and returns as Int.

## murmurhash3\_32\_hex(Str $key, uint32 $seed) returns Buf

Calculates 32-bit hash, and returns as Buf. A hex string can be obtained with `.unpack("H4")`.

## murmurhash3\_128(Str $key, uint32 $seed) returns Array[Int]

Calculates 128-bit hash, and returns as Array[Int] with length of 4.

## murmurhash3\_128\_hex(Str $key, uint32 $seed) returns Buf

Calculates 128-bit hash, and returns as Buf. A hex string can be obtained with `.unpack("H16")`.

# INSTALL

For installation from source, [zef](https://github.com/ugexe/zef) is required.

```
zef build .
zef test .
zef install .

```

# AUTHOR

yowcow [yowcow@cpan.org](mailto:yowcow@cpan.org)

# COPYRIGHT AND LICENSE

MurmurHash3 was written by [Austin Appleby](https://github.com/aappleby), and is released under MIT license.

Copyright 2016 yowcow

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


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

Interface to the DS18B20 digital thermometer from Maxim Integrated

[![CI](https://github.com/jonathanstowe/RPi-Device-DS18B20/actions/workflows/main.yml/badge.svg)](https://github.com/jonathanstowe/RPi-Device-DS18B20/actions/workflows/main.yml)

## Synopsis

```
use RPi::Device::DS18B20;

my $t = RPi::Device::DS18B20.new;

for $t.thermometers -> $thermometer {
    say $thermometer.name, ":\t", $thermometer.temperature;
}

```

Or asynchronously:

```
use RPi::Device::DS18B20;

my $t = RPi::Device::DS18B20.new;

react {
    whenever $t -> $reading {
        say $reading.when, "\t", $reading.name, "\t", $reading.temperature;
    }
}

```

The source is in the <examples> directory of the distribution.

## Description

The [DS18B20](https://www.maximintegrated.com/en/products/sensors/DS18B20.html) is a handy and inexpensive digital thermometer that uses the [Dallas 1-Wire bus](https://en.wikipedia.org/wiki/1-Wire).

The Linux kernel has support for 1-Wire which can be enabled with `raspi-config` (via `Interface Options -> 1-Wire`,) which by default enables the 1-Wire interface on GPIO 4 as per:

![Raspberry Pi GPIO pins](https://www.raspberrypi.com/documentation/computers/images/GPIO-Pinout-Diagram-2.png)

The minimum viable circuit will be something like:

[![Minimal Circuit](examples/hardware/ds18b20.png)](examples/hardware/ds18b20.png)

The 4.7K resistor is required as a pull up on the data wire, only one appears to be needed for multiple sensors on the same bus.

It can be configured on another pin (or pins,) as described [here](https://blog.oddbit.com/post/2018-03-27-multiple-1-wire-buses-on-the/)

Each thermometer has a unique identifer (in common with all 1-Wire sensors,) which means that multiple thermometers can be used on the same bus at once, however there is no way of distinguishing the devices without querying them, so a programme may need to provide its own mapping of identifier to thermometer (location etc,) this can be achieved by either wiring them in one by one, running something like the synopsis code and noting the identifier (and presumably labelling the sensor,) or by applying some heat source to each one in turn (if you have one of the encapsulated "waterproof" sensors a cup of hot water is ideal, but holding the sensor in your hand should work if the ambient temperature is lower than body temparature,) and similarly noting the identifier.

The module provides for the enumeration of the thermometers detected on the 1-Wire bus providing a list of `Thermometer` objects, having a name attribute and a `temperature` method that returns the degrees Celcius with a precision of a thousandth of a degree (though the device is commonly stated as having ±0.5⁰ accuracy so this precision may or may not be useful to you.) The default "conversion time" for the device is 750 milliseconds so requesting the temperature more frequently than that is likely to be fruitless.

Alternatively the `RPi::Device::DS18B20` object provides a `Supply` "coercion" method which allows it be used anywhere a `Supply` can be used (such as a `whenever` in a `react` block,) this will emit a `Reading` object with a `name` attribute of the sensor id, a `temperature` attribute with the measured temperature and a `when` attribute, for every sensor detected at minimum frequency determined by the `supply-interval` attribute as supplied to the constructor (the default is 30 seconds.) The readings may not be emitted in a predictable order at each interval as each sensor may take a different length of time to produce a reading, plus the bus protocol will, by necessity, serialise the readings.

## Install

Assuming you have a working copy of Rakudo you can install with *zef* :

```
zef install RPi::Device::DS18B20

```

It is unlikely to work on anything else than a Raspberry Pi.

## Support

This is difficult to test in a completely automated fashion without the actual device attached and knowing what the temparature should be so there may be bugs which I haven't noticed.

Please send any patches/suggestions/issues via [Github](https://github.com/jonathanstowe/RPi-Device-DS18B20/issues).

Ideally any reports should include the Raspberry Pi and OS versions and some indication of how the device was wired up.

This may work with other 1-Wire thermometer sensors [supported by the Linux kernel](https://www.kernel.org/doc/html/latest/w1/slaves/w1_therm.html) by adjusting the `device-class` passed to the constructor, but as I don't have any to test with right now I can't make any guarantees, it also appears that DS18B20 is by far and away the most commonly used.

## Copyright & Licence

This is free software, please see the <LICENCE> in the distribution.

© Jonathan Stowe 2022


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

# NAME

Raku port of Perl's substr() built-in

# SYNOPSIS

```
use P5substr; # exports substr()

say substr("foobar",3);   # bar
say substr("foobar",1,4); # ooba

my $a = "foobar";
substr($a,1,2) = "OO";
say $a;                   # fOObar

```

# DESCRIPTION

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

# ORIGINAL PERL DOCUMENTATION

```
substr EXPR,OFFSET,LENGTH,REPLACEMENT
substr EXPR,OFFSET,LENGTH
substr EXPR,OFFSET
        Extracts a substring out of EXPR and returns it. First character
        is at offset zero. If OFFSET is negative, starts that far back
        from the end of the string. If LENGTH is omitted, returns
        everything through the end of the string. If LENGTH is negative,
        leaves that many characters off the end of the string.

            my $s = "The black cat climbed the green tree";
            my $color  = substr $s, 4, 5;      # black
            my $middle = substr $s, 4, -11;    # black cat climbed the
            my $end    = substr $s, 14;        # climbed the green tree
            my $tail   = substr $s, -4;        # tree
            my $z      = substr $s, -4, 2;     # tr

        You can use the substr() function as an lvalue, in which case EXPR
        must itself be an lvalue. If you assign something shorter than
        LENGTH, the string will shrink, and if you assign something longer
        than LENGTH, the string will grow to accommodate it. To keep the
        string the same length, you may need to pad or chop your value
        using "sprintf".

        If OFFSET and LENGTH specify a substring that is partly outside
        the string, only the part within the string is returned. If the
        substring is beyond either end of the string, substr() returns the
        undefined value and produces a warning. When used as an lvalue,
        specifying a substring that is entirely outside the string raises
        an exception. Here's an example showing the behavior for boundary
        cases:

            my $name = 'fred';
            substr($name, 4) = 'dy';         # $name is now 'freddy'
            my $null = substr $name, 6, 2;   # returns "" (no warning)
            my $oops = substr $name, 7;      # returns undef, with warning
            substr($name, 7) = 'gap';        # raises an exception

        An alternative to using substr() as an lvalue is to specify the
        replacement string as the 4th argument. This allows you to replace
        parts of the EXPR and return what was there before in one
        operation, just as you can with splice().

            my $s = "The black cat climbed the green tree";
            my $z = substr $s, 14, 7, "jumped from";    # climbed
            # $s is now "The black cat jumped from the green tree"

        Note that the lvalue returned by the three-argument version of
        substr() acts as a 'magic bullet'; each time it is assigned to, it
        remembers which part of the original string is being modified; for
        example:

            $x = '1234';
            for (substr($x,1,2)) {
                $_ = 'a';   print $x,"\n";    # prints 1a4
                $_ = 'xyz'; print $x,"\n";    # prints 1xyz4
                $x = '56789';
                $_ = 'pq';  print $x,"\n";    # prints 5pq9
            }

        With negative offsets, it remembers its position from the end of
        the string when the target string is modified:

            $x = '1234';
            for (substr($x, -3, 2)) {
                $_ = 'a';   print $x,"\n";    # prints 1a4, as above
                $x = 'abcdefg';
                print $_,"\n";                # prints f
            }

        Prior to Perl version 5.10, the result of using an lvalue multiple
        times was unspecified. Prior to 5.16, the result with negative
        offsets was unspecified.

```

# AUTHOR

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

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

# COPYRIGHT AND LICENSE

Copyright 2018, 2019, 2020, 2021 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.


## dist_zef-JJMERELO-Text-Chart.md
# Text::Chart [Test](https://github.com/JJ/p6-text-chart/actions/workflows/test.yaml)

A simple Text Chart for Raku

## Running an example

`raku-text-chart` should have been installed in your binary directory, you
can run it directly this way:

```
raku-text-chart 3 2 1 4

```

Obtaining a result such as this one:

```

   ▮
   ▮
▮  ▮
▮  ▮
▮  ▮
▮▮ ▮
▮▮ ▮
▮▮▮▮
▮▮▮▮

```

Or you can use

```
raku-text-chart --max=4 --chart-chars=▐░▓█ 3 2 1 4

```

Which will give us:

```
   █
▐  █
▐░ █
▐░▓█

```

## License

This is distributed under the GNU GPL v3


## dist_zef-dwarring-LibXML.md
[![Actions Status](https://github.com/libxml-raku/LibXML-raku/workflows/test/badge.svg)](https://github.com/libxml-raku/LibXML-raku/actions)
[![SparrowCI](https://ci.sparrowhub.io/project/git-dwarring-LibXML-raku/badge)](https://ci.sparrowhub.io)

[[Raku LibXML Project]](https://libxml-raku.github.io)
/ [[LibXML Module]](https://libxml-raku.github.io/LibXML-raku)
/

# NAME

LibXML - Raku bindings to the libxml2 native library

# SYNOPSIS

```
use LibXML;
use LibXML::Document;
my LibXML::Document $doc .=  parse: :string('<Hello/>');
$doc.root.nodeValue = 'World!';
say $doc.Str;
# <?xml version="1.0" encoding="UTF-8"?>
# <Hello>World!</Hello>
say $doc<Hello>;
# <Hello>World!</Hello>

my Version $library-version = LibXML.version;
my Version $module-version = LibXML.^ver;

```

# DESCRIPTION

This module is an interface to libxml2, providing XML and HTML parsers with DOM, SAX and XMLReader interfaces, a large subset of DOM Layer 3 interface and a XML::XPath-like interface to XPath API of libxml2.

For further information, please check the following documentation:

## DOM Objects

The nodes in the Document Object Model (DOM) are represented by the following classes (most of which "inherit" from [LibXML::Node](https://libxml-raku.github.io/LibXML-raku/Node)):

* [LibXML::Document](https://libxml-raku.github.io/LibXML-raku/Document) - LibXML DOM document class
* [LibXML::Attr](https://libxml-raku.github.io/LibXML-raku/Attr) - LibXML attribute class
* [LibXML::CDATA](https://libxml-raku.github.io/LibXML-raku/CDATA) - LibXML class for DOM CDATA sections
* [LibXML::Comment](https://libxml-raku.github.io/LibXML-raku/Comment) - LibXML class for comment DOM nodes
* [LibXML::DocumentFragment](https://libxml-raku.github.io/LibXML-raku/DocumentFragment) - LibXML's DOM L2 Document Fragment implementation
* [LibXML::Dtd](https://libxml-raku.github.io/LibXML-raku/Dtd) - LibXML front-end for DTD validation
* [LibXML::Element](https://libxml-raku.github.io/LibXML-raku/Element) - LibXML class for element nodes
* [LibXML::EntityRef](https://libxml-raku.github.io/LibXML-raku/EntityRef) - LibXML class for entity references
* [LibXML::Namespace](https://libxml-raku.github.io/LibXML-raku/Namespace) - LibXML namespaces (Inherits from [LibXML::Item](https://libxml-raku.github.io/LibXML-raku/Item))
* [LibXML::Node](https://libxml-raku.github.io/LibXML-raku/Node) - LibXML DOM abstract base node class
* [LibXML::Text](https://libxml-raku.github.io/LibXML-raku/Text) - LibXML text node class
* [LibXML::PI](https://libxml-raku.github.io/LibXML-raku/PI) - LibXML DOM processing instruction nodes

See also [LibXML::DOM](https://libxml-raku.github.io/LibXML-raku/DOM), which summarizes DOM classes and methods.

## Container/Mapping classes

* [LibXML::Attr::Map](https://libxml-raku.github.io/LibXML-raku/Attr/Map) - LibXML DOM attribute map class
* [LibXML::Node::List](https://libxml-raku.github.io/LibXML-raku/Node/List) - Sibling Node Lists
* [LibXML::Node::Set](https://libxml-raku.github.io/LibXML-raku/Node/Set) - XPath Node Sets
* [LibXML::HashMap](https://libxml-raku.github.io/LibXML-raku/HashMap) - LibXML Hash Bindings

## Parsing

* [LibXML::Parser](https://libxml-raku.github.io/LibXML-raku/Parser) - LibXML Parser bindings
* [LibXML::PushParser](https://libxml-raku.github.io/LibXML-raku/PushParser) - LibXML Push Parser bindings
* [LibXML::Reader](https://libxml-raku.github.io/LibXML-raku/Reader) - LibXML Reader (pull parser) bindings

### SAX Parser

* [LibXML::SAX::Builder](https://libxml-raku.github.io/LibXML-raku/SAX/Builder) - Builds SAX callback sets
* [LibXML::SAX::Handler::SAX2](https://libxml-raku.github.io/LibXML-raku/SAX/Handler/SAX2) - SAX handler base class
* [LibXML::SAX::Handler::XML](https://libxml-raku.github.io/LibXML-raku/SAX/Handler/XML) - SAX Handler for XML

## XPath and Searching

* [LibXML::XPath::Expression](https://libxml-raku.github.io/LibXML-raku/XPath/Expression) - XPath Compiled Expressions
* [LibXML::XPath::Context](https://libxml-raku.github.io/LibXML-raku/XPath/Context) - XPath Evaluation Contexts
* [LibXML::Pattern](https://libxml-raku.github.io/LibXML-raku/Pattern) - LibXML Patterns
* [LibXML::RegExp](https://libxml-raku.github.io/LibXML-raku/RegExp) - LibXML Regular Expression bindings

## Validation

* [LibXML::Dtd](https://libxml-raku.github.io/LibXML-raku/Dtd) - LibXML DTD validation class
* [LibXML::Schema](https://libxml-raku.github.io/LibXML-raku/Schema) - LibXML schema validation class
* [LibXML::RelaxNG](https://libxml-raku.github.io/LibXML-raku/RelaxNG) - LibXML RelaxNG validation class

## Other

* [LibXML::Config](https://libxml-raku.github.io/LibXML-raku/Config) - LibXML global and local configuration
* [LibXML::Enums](https://libxml-raku.github.io/LibXML-raku/Enums) - XML\_\* enumerated constants
* [LibXML::Raw](https://libxml-raku.github.io/LibXML-raku/Raw) - LibXML native interface
* [LibXML::ErrorHandling](https://libxml-raku.github.io/LibXML-raku/ErrorHandling) - LibXML class for Error handling
* [LibXML::InputCallback](https://libxml-raku.github.io/LibXML-raku/InputCallback) - LibXML class for Input callback handling
* See also [LibXML::Threads](https://libxml-raku.github.io/LibXML-raku/Threads), for notes on threading and concurrency

# PREREQUISITES

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

## Debian/Ubuntu Linux

```
sudo apt-get install libxml2-dev

```

Additional packages (such as build-essential) may be required to enable make, C compilation and linking.

## Mac OS X

```
brew update
brew install libxml2

```

The Xcode package also needs to be installed to enable compilation.

## Windows

This module uses prebuilt DLLs on Windows. There are currently some configuration (`LibXML::Config`) restrictions:

* `parser-locking` is set `True` to to disable concurrent parsing. This is due to known threading issues and unresolved failures in `t/90threads.t`
* `iconv` is `False`. The library is built without full Unicode support, which restricts the ability to read and write various encoding schemes.
* `compression` is `False`. The library is built without full compression, and is unable to read and write compressed XML directly.

# ACKNOWLEDGEMENTS

This Raku module:

* is based on the Perl XML::LibXML module; in particular, the test suite, selected XS and C code and documentation.
* derives SelectorQuery() and SelectorQueryAll() methods from the Perl XML::LibXML::QuerySelector module.
* also draws on an earlier attempt at a Perl 6 (nee Raku) port (XML::LibXML).

With thanks to: Christian Glahn, Ilya Martynov, Matt Sergeant, Petr Pajas, Shlomi Fish, Toby Inkster, Tobias Leich, Xliff, and others.

# COPYRIGHT

2001-2007, AxKit.com Ltd.

2002-2006, Christian Glahn.

2006-2009, Petr Pajas.

# LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0 <http://www.perlfoundation.org/artistic_license_2_0>.


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

# NAME

IDNA::Punycode - Punycode implementation according to RFC3492

# SYNOPSIS

```
use IDNA::Punycode;

say encode_punycode 'nice'  # nice
say encode_punycode 'schön' # xn--schn-7qa

say decode_punycode 'nice'         # nice
say decode_punycode 'xn--schn-7qa' # schön

```

# DESCRIPTION

The `IDNA::Punycode` provides an easy way to encode / decode strings according to [RFC3492](https://www.rfc-editor.org/info/rfc3492).

# AUTHOR

Tobias Leich (FROGGS)

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

# COPYRIGHT AND LICENSE

Copyright 2015, 2016, 2017 Tobias Leich, 2023 Raku Community

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


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

# NAME

Rakudo::CORE::META - Provide zef compatible meta-data for Rakudo

# SYNOPSIS

```
use Rakudo::CORE::META;
say "Rakudo core provides these additional modules:";
.say for %Rakudo::CORE::META<provides>.keys.sort(*.fc);

```

# DESCRIPTION

Rakudo::CORE::META provides zef compatible meta-data of the modules that are provided by the Rakudo core, by exporting `%Rakudo::CORE::META` hash. This hash contains information that could be introspected at installation time of the module, or after any Rakudo core update.

# AUTHOR

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

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

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

# COPYRIGHT AND LICENSE

Copyright 2021, 2022 Elizabeth Mattijsen

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


## dist_github-azawawi-Parse-Selenese.md
# Parse::Selenese [Build Status](https://travis-ci.org/azawawi/perl6-parse-selenese)

This is a simple utility to parse Selenese test cases and suites that are
usually generated from the Selenium IDE.

## Example

```
use Parse::Selenese;

my $selenese = qq{<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://some-server:3000/" />
<title>Login</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Login</td></tr>
</thead><tbody>
<tr>
	<td>open</td>
	<td>/login</td>
	<td></td>
</tr>
<tr>
	<td>type</td>
	<td>name=username</td>
	<td>admin</td>
</tr>
<tr>
	<td>type</td>
	<td>name=password</td>
	<td>123</td>
</tr>
<tr>
	<td>clickAndWait</td>
	<td>//button[@type='submit']</td>
	<td></td>
</tr>
<tr>
	<td>verifyTitle</td>
	<td>regex:Home</td>
	<td></td>
</tr>

</tbody></table>
</body>
</html>
};

my $parser = Parse::Selenese.new;
my $result = $parser.parse($selenese);
if $result {
  say "Matches with the following results: " ~ $result.ast.perl;
} else {
  say "Fails";
}

```

## Installation

To install it using Panda (a module management tool bundled with Rakudo Star):

```
$ panda update
$ panda install Parse::Selenese

```

## Testing

To run tests:

```
$ prove -e "perl6 -Ilib"

```

## Author

Ahmad M. Zawawi, azawawi on #perl6, <https://github.com/azawawi/>

## License

Artistic License 2.0


## dist_zef-kjpye-Geo-Geometry.md
[![Actions Status](https://github.com/kjpye/Raku-Geo-Geometry/actions/workflows/test.yml/badge.svg)](https://github.com/kjpye/Raku-Geo-Geometry/actions)

# TITLE

Geo::Geometry

`Geo::Geometry` is a module containing a series of classes defining objects descibing geographic objects.

The module is based on chapters 8 and 9 of the Open Geospatial Consortium's *OpenGISⓇ Implemantation Standard for Geographic Information - Simple Feature Access - part 1: Common architecture*. This can be obtained from <https://www.ogc.org/standards/sfa>.

# Geo::Geometry

A series of classes for storing geographic data.

## Generic Methods

The following methods are available for most classes. Classes for which they are not available are documented below.

### type

The `type` method returns a member of the `WKBGeometryType` enum corresponding to the geometry type.

### Str

The `Str` method returns a string representing the object. Note that this is **not** the WKT representation, which can be obtained using the `wkt` method described below.

### wkb

The `wkb` method will produce a `Buf` object with the well-known-binary representation of the object. An optional named argument `byteorder` parameter is available. The value of the argument is one of the values of the `WKBByteOrder` enum. The default value is `wkbXDR` (little endian) with the alternative being `wkbNDR` (big endian).

### wkt

The `wkt` method returns a string containing the well-known text representation of the geometry.

### tobuf

The `tobuf` method is used internally; This interface may change without warning.

## Subroutines

The subroutines `from-wkb` and `from-wkt` previously available in this module are now avialable from `Geo::WellKnownBinary` and `Geo::WellKnownText` respectively.

## Enums

Two enums are defined which represent values used in the WKB representation of a geometry.

### WKBByteOrder

The `WKBByteOrder` enum gives the values used in the byte order field of a WKB representation. It contains two values `wkbXDR` (0, little-endian) and `wkbBDR` (1, big-endian).

### WKBGeometryType

The `WKBGeometryType` enum contains the values used in the geometry type filed of a WKB representation. It allows for the following values:

|  |  |
| --- | --- |
| 1 | wkbPoint |
| 2 | wkbLineString |
| 3 | wkbPolygon |
| 4 | wkbMultiPoint |
| 5 | wkbMultiLineString |
| 6 | wkbMultiPolygon |
| 7 | wkbGeometryCollection |
| 15 | wkbPolyhedralSurface |
| 16 | wkbTIN |
| 17 | wkbTriangle |
| 1001 | wkbPointZ |
| 1002 | wkbLineStringZ |
| 1003 | wkbPolygonZ |
| 1004 | wkbMultiPointZ |
| 1005 | wkbMultiLineStringZ |
| 1006 | wkbMultiPolygonZ |
| 1007 | wkbGeometryCollectionZ |
| 1015 | wkbPolyhedralSurfaceZ |
| 1016 | wkbTINZ |
| 1017 | wkbTriangleZ |
| 2001 | wkbPointM |
| 2002 | wkbLineStringM |
| 2003 | wkbPolygonM |
| 2004 | wkbMultiPointM |
| 2005 | wkbMultiLineStringM |
| 2006 | wkbMultiPolygonM |
| 2007 | wkbGeometryCollectionM |
| 2015 | wkbPolyhedralSurfaceM |
| 2016 | wkbTINM |
| 2017 | wkbTriangleM |
| 3001 | wkbPointZM |
| 3002 | wkbLineStringZM |
| 3003 | wkbPolygonZM |
| 3004 | wkbMultiPointZM |
| 3005 | wkbMultiLineStringZM |
| 3006 | wkbMultiPolygonZM |
| 3007 | wkbGeometryCollectionZM |
| 3015 | wkbPolyhedralSurfaceZM |
| 3016 | wkbTINZM |
| 3017 | wkbTriangleZM |

## Object types (classes)

### Geometry

`Geometry` is a role which all the other objects inherit. It contains no methods, and is simply a marker that another class is a Geometry type.

If you want to check whether a variable contains any of the geometry classes, then code like

```
  if $variable ~~ Geometry { ... }

```

can be useful.

### Point

### PointZ

### PointM

### PointZM

The `Point` class represents a single point geometry. It has two attributes, `x` and `y`, each of which is constrained to be a 64-bit floating point number (`num`).

The `PointZ` class also contains a third attribute `z` to represent a third dimension.

The `PointM` class, in addition to the `X` and `y` attributes contains an `m` attribute which can contain an arbitrary "measure" in addition to the two-dimensionallocation.

The `PointMZ` class combines the `z` attribute of `PointZ` and the `m` attribute of `PointM`.

An object of each class may be constructed either by using named parameters (`Point.new(x => 10, y => 12)`, or by using positional parameters (`PointZ.new(1,2,3)`). When positional parameters are used, the ordering of the parameters is `x`, `y`, `z`, `m`; omitting those parameters which are not appropriate for the object type.

All the parameters of a point geometry are required. `NaN` might be used if an `m` parameter for example were not required.

Accessor methodes are available for the `x`, `y`, `z` and `m`.

## LineString

## LineStringZ

## LineStringM

## LineStringZM

The `LineString` class represents a single line, a sequence of `Point`s, not necessarily closed.

Similarly, `LineStringZ`, `LineStringM` and `LineStringZM` are lines consisting of sequences of `PointZ`s, `PointM`sand `PointZM`s respectively.

An object in the LineString family is created by passing an array of the appropriate point type geometries, to the named argument `points`.

At the moment there is no way of accessing the contents of a LineString geometry other than using the standard methods.

An accessor method `points` will give the constituent points.

### LinearRing

### LinearRingZ

### LinearRingM

### LinearRingZM

Objects in the LinearRing classes are not normally intended for end users, apart from their use in creating more complex objects. None of the usual methods apply to these types of object.

A linear ring is similar to a line string, but is closed; i.e. the last point should be identical to the first point. This is not currently enforced, but may be in the future. Creation of a linear ring is the same as that of a line string. The ring should be simple; the path should not cross itself. This is also not enforced.

Each of these classes has a `winding` method. This determines whether the linear ring is clockwise (a positive number is returned) or anti-clockwise (a negative number is returned). This method will be unreliable unless the linear ring actually is a simple closed loop. The winding method ignores everything except the `x` and `y` attributes.

An accessor method `points` will give the constituent points.

### Polygon

### PolygonZ

### PolygonM

### PolygonZM

A `Polygon` consists of one or more `LinearRings`. In general, the first linear ring should be clockwise (with a positive winding number). The other linear rings should be fully enclosed within the first and be disjoint from each other. They should have a negative winding number. These rings represent a polygon (the first ring) and holes within that polygon, represented by the other rings. Having only a single ring specified is acceptable (and normal under most circumstances), representing a polygon without holes.

A `Polygon` is created using an array of rings, such as `Polygon.new(rings => @rings)`.

An accessor method `rings` will give the constituent rings.

`PolygonZ`, `PolygonM` and `PolygonZM` behave similarly.

### Triangle

### TriangleZ

### TriangleM

### TriangleZM

A triangle is a polygon where the outer ring has exactly four points, the fourth being the same as the first and otherwise having no oints in common. The points must not be in a straight line. No internal rings are permitted.

An accessor method `rings` gives the constituent rings.

### PolyhedralSurface

### PolyhedralSurfaceZ

### PolyhedralSurfaceM

### PolyhedralSurfaceZM

A polyhedral surface is a set of contiguous non-overlapping polygons. (There are further restrictions.)

### TIN

### TINZ

### TINM

### TINZM

A triangular irregular network is a polyhedral surface consisting only of triangles.

### MultiPoint

### MultiPointZ

### MultiPointM

### MultiPointZM

The MultiPoint classes behave just like LineStrings, including their definition. The difference is the intent of the object. A LineString, as the name implies, forms a line. A MultiPoint object is just a collection of points.

### MultiLineString

### MultiLineStringZ

### MultiLineStringM

### MultiLineStringZM

A `MultiLineString` object contains an array of `LineString`s. It is created with that array:

```
     MultiLineString.new(linestrings => @array-of-linestrings)

```

### MultiPolygon

### MultiPolygonZ

### MultiPolygonM

### MultiPolygonZM

Just as a `MultiPoint` is a collections of `Point`s, and a `MultiLineString` is a collection of `LineString`s, a `MultiPolygon` is a collection of `Polygon`s.

### GeometryCollection

### GeometryCollectionZ

### GeometryCollectionM

### GeometryCollectionZM

A GeometryCollection is an arbitrary collection of geometry objects. Unlike a PointCollection, a LineStringCollection or a PolygonCollection, the objects do not need to be of the same geometry type.


## dist_zef-CIAvash-APISports-Football.md
# NAME

APISports::Football - An interface to [API-Football](https://www.api-football.com/).

# DESCRIPTION

APISports::Football is a [Raku](https://www.raku-lang.ir/en) module for interfacing with [API Sports Football](https://v3.football.api-sports.io).

An API key is required to use the API.

# SYNOPSIS

```
use APISports::Football:auth<zef:CIAvash>;

my $f = APISports::Football.new: :api_key<1234>;

my @competitions = $f.competitions: name => 'premier league', :current, type => LeagueType::League, :country<england>;

```

# INSTALLATION

You need to have [Raku](https://www.raku-lang.ir/en) and [zef](https://github.com/ugexe/zef), then run:

```
zef install "APISports::Football:auth<zef:CIAvash>"

```

or if you have cloned the repo:

```
zef install .

```

# TESTING

```
prove -ve 'raku -I.' --ext rakutest

```

or

```
prove6 -I. -v

```

# ATTRIBUTES

## has Str $.api\_key

API key required by api-football.com

## has APISports::Football::HTTPClient $.http\_client

An object for making requests to api-football.com

# METHODS

## method timezones

```
method timezones(
    Bool :h(:$http_body)
) returns Mu

```

Get the respone object containing list of available timezones.

## Bool :h(:$http\_body)

Get the HTTP response body

## method countries

```
method countries(
    Bool :h(:$http_body),
    *%params (Str :$name, Str :$code where { ... }, Str :$search where { ... })
) returns Mu

```

Get the respone object containing list of available countries.

### Bool :h(:$http\_body)

Get the HTTP response body

### Str :$name

Name of the country

### TwoChars :$code

Code of the country

### SearchTerm :$search

Name of the country

## method seasons

```
method seasons(
    Bool :h(:$http_body)
) returns Mu

```

Get the respone object containing list of available seasons for competitions.

### Bool :h(:$http\_body)

Get the HTTP response body

## method competitions

```
method competitions(
    Bool :h(:$http_body),
    *%params (Int :$id where { ... }, Str :$name, Str :$country, Str :$code where { ... }, Int :$season where { ... }, Int :$team where { ... }, LeagueType(Str) :$type, Bool :$current, Str :$search where { ... }, Int :$last where { ... })
) returns Mu

```

Get the respone object containing list of available competitions.

### Bool :h(:$http\_body)

Get the HTTP response body

### ID :$id

ID of the league

### Str :$name

Name of the league

### Str :$country

Country name of the league

### TwoChars :$code

Code of the country

### Year :$season

Season of the league

### ID :$team

ID of the team

### LeagueType(Str) :$type

Type of the league

### Bool :$current

State of the league

### SearchTerm :$search

Name or country name of the league

### AtMost2Digits :$last

The X last leagues added to the API

## method clubs

```
method clubs(
    Bool :h(:$http_body),
    *%params (Int :$id where { ... }, Str :$name, Int :$league where { ... }, Str :$country, Int :$season where { ... }, Str :$search where { ... })
) returns Mu

```

Get the respone object containing list of available clubs.

### Bool :h(:$http\_body)

Get the HTTP response body

### ID :$id

ID of the team

### Str :$name

Name of the team

### ID :$league

ID of the league

### Str :$country

Country name of the team

### Year :$season

Season of the league

### SearchTerm :$search

Name or country name of the team

## method team\_stats

```
method team_stats(
    Bool :h(:$http_body),
    *%params (Int :$team! where { ... }, Int :$league! where { ... }, Int :$season! where { ... }, Date(Any) :$date)
) returns Mu

```

Get the respone object containing team's statistics.

### Bool :h(:$http\_body)

Get the HTTP response body

### ID :$team!

ID of the team

### ID :$league!

ID of the league

### Year :$season!

Season of the league

### Date() :$date

The limit date

## method team\_seasons

```
method team_seasons(
    Bool :h(:$http_body),
    *%params (Int :$team! where { ... })
) returns Mu

```

Get the respone object containing list of available seasons for a team.

### Bool :h(:$http\_body)

Get the HTTP response body

### ID :$team!

ID of the team

## method venues

```
method venues(
    Bool :h(:$http_body),
    *%params (Int :$id where { ... }, Str :$name, Str :$country, Str :$search where { ... })
) returns Mu

```

Get the respone object containing list of available venues.

### Bool :h(:$http\_body)

Get the HTTP response body

### ID :$id

ID of the venue

### Str :$name

Name of the venue

### Str :$country

Country name of the venue

### SearchTerm :$search

Name, city or the country of the venue

## method tables

```
method tables(
    Bool :h(:$http_body),
    *%params (Int :$team where { ... }, Int :$league where { ... }, Int :$season! where { ... })
) returns Mu

```

Get the respone object containing standings of a league or team.

### Bool :h(:$http\_body)

Get the HTTP response body

### ID :$team

ID of the team

### ID :$league

ID of the league

### Year :$season!

Season of the league

## method rounds

```
method rounds(
    Bool :h(:$http_body),
    *%params (Int :$league! where { ... }, Int :$season! where { ... }, Bool :$current)
) returns Mu

```

Get the respone object containing list of rounds for a league or cup.

### Bool :h(:$http\_body)

Get the HTTP response body

### ID :$league!

ID of the league

### Year :$season!

Season of the league

### Bool :$current

Current round only

## method matches

```
method matches(
    Bool :h(:$http_body),
    *%params (Int :$id where { ... }, Str :$live where { ... }, Date(Any) :$date, Int :$league where { ... }, Int :$season where { ... }, Int :$team where { ... }, Int :$last where { ... }, Int :$next where { ... }, Date(Any) :$from, Date(Any) :$to, Str :$round, MatchStatus(Str) :$status, Str :$timezone where { ... })
) returns Mu

```

Get the respone object containing list of available matches.

### Bool :h(:$http\_body)

Get the HTTP response body

### ID :$id

ID of the fixture

### AllOrIDs :$live

all or IDs of two teams

### Date() :$date

A valid date

### ID :$league

ID of the league

### Year :$season

Season of the league

### ID :$team

ID of the team

### AtMost2Digits :$last

For the X last fixtures

### AtMost2Digits :$next

For the X next fixtures

### Date() :$from

Fixtures from date

### Date() :$to

Fixtures to date

### Str :$round

Round of the fixture

### MatchStatus(Str) :$status

Status of the fixture

### Timezone :$timezone

A valid timezone

## method head\_to\_head

```
method head_to_head(
    Bool :h(:$http_body),
    *%params (Str :$h2h! where { ... }, Date(Any) :$date, Int :$league where { ... }, Int :$season where { ... }, Int :$last where { ... }, Int :$next where { ... }, Date(Any) :$from, Date(Any) :$to, MatchStatus(Str) :$status, Str :$timezone where { ... })
) returns Mu

```

Get the respone object containing list of head to heads between two teams.

### Bool :h(:$http\_body)

Get the HTTP response body

### IDs :$h2h!

IDs of two teams

### Date() :$date

Date of the fixtures

### ID :$league

ID of the league

### Year :$season

Season of the league

### AtMost2Digits :$last

For the X last fixtures

### AtMost2Digits :$next

For the X next fixtures

### Date() :$from

Fixtures from date

### Date() :$to

Fixtures to date

### MatchStatus(Str) :$status

Status of the fixture

### Timezone :$timezone

A valid timezone

## method match\_stats

```
method match_stats(
    Bool :h(:$http_body),
    *%params (Int :$fixture! where { ... }, Int :$team where { ... }, MatchStats(Str) :$type)
) returns Mu

```

Get the respone object containing statistics of a match.

### Bool :h(:$http\_body)

Get the HTTP response body

### ID :$fixture!

ID of the fixture

### ID :$team

ID of the team

### MatchStats(Str) :$type

Type of statistics

## method fixture\_events

```
method fixture_events(
    Bool :h(:$http_body),
    *%params (Int :$fixture! where { ... }, Int :$team where { ... }, Int :$player where { ... }, FixtureEvent(Str) :$type)
) returns Mu

```

Get the respone object containing events for a fixture.

### Bool :h(:$http\_body)

Get the HTTP response body

### ID :$fixture!

ID of the fixture

### ID :$team

ID of the team

### ID :$player

ID of the player

### FixtureEvent(Str) :$type

Type of events

## method fixture\_lineups

```
method fixture_lineups(
    Bool :h(:$http_body),
    *%params (Int :$fixture! where { ... }, Int :$team where { ... }, Int :$player where { ... }, FixtureLineup(Str) :$type)
) returns Mu

```

Get the respone object containing lineups for a fixture.

### Bool :h(:$http\_body)

Get the HTTP response body

### ID :$fixture!

ID of the fixture

### ID :$team

ID of the team

### ID :$player

ID of the player

### FixtureEvent(Str) :$type

Type of lineups

## method fixture\_players

```
method fixture_players(
    Bool :h(:$http_body),
    *%params (Int :$fixture! where { ... }, Int :$team where { ... })
) returns Mu

```

Get the respone object containing statistics for players from a fixture.

### Bool :h(:$http\_body)

Get the HTTP response body

### ID :$fixture!

ID of the fixture

### ID :$team

ID of the team

## method injuries

```
method injuries(
    Bool :h(:$http_body),
    *%params (Int :$league where { ... }, Int :$fixture where { ... }, Int :$team where { ... }, Int :$player where { ... }, Date(Any) :$date, Int :$season where { ... }, Str :$timezone where { ... })
) returns Mu

```

Get the respone object containing list of players not participating in matches.

### Bool :h(:$http\_body)

Get the HTTP response body

### ID :$league

ID of the league

### ID :$fixture

ID of the fixture

### ID :$team

ID of the team

### ID :$player

ID of the player

### Date() :$date

Date of the injury

### Year :$season

Season of the league, required with league, team and player parameters

### Timezone :$timezone

A valid timezone

## method predictions

```
method predictions(
    Bool :h(:$http_body),
    *%params (Int :$fixture! where { ... })
) returns Mu

```

Get the respone object containing predictions for a fixture.

### Bool :h(:$http\_body)

Get the HTTP response body

### ID :$fixture!

ID of the fixture

## method coachs

```
method coachs(
    Bool :h(:$http_body),
    *%params (Int :$id where { ... }, Int :$team where { ... }, Str :$search where { ... })
) returns Mu

```

Get the respone object containing information about coachs and their careers.

### Bool :h(:$http\_body)

Get the HTTP response body

### ID :$id

ID of the coach

### ID :$team

ID of the team

### SearchTerm :$search

Name of the coach

## method players

```
method players(
    Bool :h(:$http_body),
    *%params (Int :$id where { ... }, Int :$team where { ... }, Int :$league where { ... }, Int :$season where { ... }, Str :$search where { ... }, Int :$page)
) returns Mu

```

Get the respone object containing information and statistics about players.

### Bool :h(:$http\_body)

Get the HTTP response body

### ID :$id

ID of the player

### ID :$team

ID of the team

### ID :$league

ID of the league

### Year :$season

Season of the league

### SearchTerm :$search

Name of the player

### Int :$page

Use for pagination

## method player\_seasons

```
method player_seasons(
    Bool :h(:$http_body),
    *%params (Int :$player where { ... })
) returns Mu

```

Get the respone object containing list of available seasons for players statistics.

### Bool :h(:$http\_body)

Get the HTTP response body

### ID :$player

ID of the player

## method squads

```
method squads(
    Bool :h(:$http_body),
    *%params (Int :$player where { ... }, Int :$team where { ... })
) returns Mu

```

Get the respone object containing squad of a team or squads of a player.

### Bool :h(:$http\_body)

Get the HTTP response body

### ID :$player

ID of the player

### ID :$team

ID of the team

## method top\_scorers

```
method top_scorers(
    Bool :h(:$http_body),
    *%params (Int :$league! where { ... }, Int :$season! where { ... })
) returns Mu

```

Get the respone object containing best players for a league or cup.

### Bool :h(:$http\_body)

Get the HTTP response body

### ID :$league!

ID of the league

### Year :$season!

Season of the league

## method top\_assists

```
method top_assists(
    Bool :h(:$http_body),
    *%params (Int :$league! where { ... }, Int :$season! where { ... })
) returns Mu

```

Get the respone object containing best assists for a league or cup.

### Bool :h(:$http\_body)

Get the HTTP response body

### ID :$league!

ID of the league

### Year :$season!

Season of the league

## method top\_yellow\_cards

```
method top_yellow_cards(
    Bool :h(:$http_body),
    *%params (Int :$league! where { ... }, Int :$season! where { ... })
) returns Mu

```

Get the respone object containing players with the most yellow cards for a league or cup.

### Bool :h(:$http\_body)

Get the HTTP response body

### ID :$league!

ID of the league

### Year :$season!

Season of the league

## method top\_red\_cards

```
method top_red_cards(
    Bool :h(:$http_body),
    *%params (Int :$league! where { ... }, Int :$season! where { ... })
) returns Mu

```

Get the respone object containing players with the most red cards for a league or cup.

### Bool :h(:$http\_body)

Get the HTTP response body

### ID :$league!

ID of the league

### Year :$season!

Season of the league

## method transfers

```
method transfers(
    Bool :h(:$http_body),
    *%params (Int :$player where { ... }, Int :$team where { ... })
) returns Mu

```

Get the respone object containing all available transfers for players and teams.

### Bool :h(:$http\_body)

Get the HTTP response body

### ID :$player

ID of the player

### ID :$team

---

ID of the team

## method trophies

```
method trophies(
    Bool :h(:$http_body),
    *%params (Int :$player where { ... }, Int :$coach where { ... })
) returns Mu

```

Get the respone object containing all available trophies for a player or coach.

### Bool :h(:$http\_body)

Get the HTTP response body

### ID :$player

ID of the player

### ID :$coach

ID of the coach

## method sidelined

```
method sidelined(
    Bool :h(:$http_body),
    *%params (Int :$player where { ... }, Int :$coach where { ... })
) returns Mu

```

Get the respone object containing all available sidelined information for a player or coach.

### Bool :h(:$http\_body)

Get the HTTP response body

### ID :$player

ID of the player

### ID :$coach

ID of the coach

# ERRORS

* If a response contains errors, a `Failure` of type `X::APISports::Football::APIError` is returned.
* If HTTP errors occur, `Failure` of type `X::APISports::Football::HTTPError` is returned.

# REPOSITORY

<https://codeberg.org/CIAvash/APISports-Football>

# BUGS

<https://codeberg.org/CIAvash/APISports-Football/issues>

# AUTHOR

Siavash Askari Nasr <https://siavash.askari-nasr.com>

# COPYRIGHT

Copyright © 2022 Siavash Askari Nasr

# LICENSE

APISports::Football is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

APISports::Football is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with APISports::Football. If not, see <http://www.gnu.org/licenses/>.


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

# NAME

Image::PNG::Portable - portable PNG output for Raku

# SYNOPSIS

```
use Image::PNG::Portable;
my $o = Image::PNG::Portable.new: :width(16), :height(16);
$o.set: 8,8, 255,255,255;
$o.write: 'image.png';

```

## STATUS

This module is currently useful for outputting 8-bit-per-channel truecolor images. Reading, precompression filters, palettes, grayscale, non-8-bit channels, and ancillary features like gamma correction, color profiles, and textual metadata are all NYI.

# DESCRIPTION

This is an almost-pure Raku PNG module.

# USAGE

The following types are used internally and in this documentation. They are here for brevity, not exported in the public API.

```
subset UInt8 of Int where 0 <= * <= 255; # unsigned 8-bit
subset PInt  of Int where * > 0;         # positive

```

# METHODS

## .new(PInt :$width!, PInt :$height!, Bool $alpha = True)

Creates a new `Image::PNG::Portable` object, initialized to black. If the alpha channel is enabled, it is initialized to transparent.

## .set(UInt $x, UInt $y, UInt8 $red, UInt8 $green, UInt8 $blue, UInt8 $alpha = 255)

Sets the color of a pixel in the image.

## .set-all(UInt8 $red, UInt8 $green, UInt8 $blue, UInt8 $alpha = 255)

Sets the color of all pixels in the image.

## .get(UInt $x, UInt $y)

Gets the color of a pixel in the image as an array of channel values.

## .write($file)

Writes the contents of the image to the specified file.

# AUTHOR

raydiak

# COPYRIGHT AND LICENSE

Copyright 2015 - 2021 raydiak

Copyright 2025 Raku Community

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


## dist_zef-nige123-WAT.md
# wat.nigelhamilton.com

wat - does this code do? LLM-powered utility for quickly understanding code.

Usage:

```
wat <filename>              -- summarise what the program does
wat "$some-code.here();"    -- explain what some code does

```

![](images/demo.gif?raw=true)


## code.md
code

Combined from primary sources listed below.

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

See primary documentation
[in context](/type/CallFrame#method_code)
for **method code**.

```raku
method code()
```

Return the callable code for the current block. When called on the object returned by `callframe(0)`, this will be the same value found in [`&?BLOCK`](/language/variables#Compile-time_variables).

```raku
my $frame;
for ^3 { FIRST $frame = callframe; say $_ * 3 };
say $frame.code()

```

The `$frame` variable will hold the [`Code`](/type/Code) for the block inside the loop in this case.

# [In Backtrace::Frame](#___top "go to top of document")[§](#(Backtrace::Frame)_method_code "direct link")

See primary documentation
[in context](/type/Backtrace/Frame#method_code)
for **method code**.

```raku
method code(Backtrace::Frame:D)
```

Returns the code object into which `.file` and `.line` point, if available.

```raku
my $bt = Backtrace.new;
my $btf = $bt[0];
say $btf.code;
```