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

# NAME

Geo::Coder::OpenCage - Geocode addresses with the OpenCage Geocoder API

# DESCRIPTION

This module provides an interface to the OpenCage geocoding service.

For full details on the API visit <https://opencagedata.com>.

# SYNOPSIS

```
my $geocoder = Geo::Coder::OpenCage.new: api_key => $my_api_key;
my $result = $geocoder.geocode("Donostia");

```

## class Geo::Coder::OpenCage

That's the object you'll use to interface with the OpenCage API. It has a required attribute C, which you can obtain from <http://geocoder.opencagedata.com>.

### method geocode

```
method geocode(
    Str $place-name,
    *%params
) returns Geo::Coder::OpenCage::Response

```

This method calls to the OpenCage API to obtain geocoding results for C<$place-name>. It returns an object with convenient access methods for all the data that the API returns. You can pass additional hints and requirements to the API through the slurpy C<%params> argument. The validity of these parameters will B be verified/enforced to ensure compatibility with potential API changes. Some of the supported arguments include: C – An IETF format language code (such as es for Spanish or pt-BR for Brazilian Portuguese); if this is omitted a code of en (English) will be assumed. C – Provides the geocoder with a hint to the country that the query resides in. This value will help the geocoder but will not restrict the possible results to the supplied country. The country code is a 3 character code as defined by the ISO 3166-1 Alpha 3 standard. As a full example: my $result = $geocoder.geocode( location => "Псковская улица, Санкт-Петербург, Россия", language => "ru", country => "rus", );

### method reverse-geocode

```
method reverse-geocode(
    Numeric $lat,
    Numeric $lng,
    *%params
) returns Geo::Coder::OpenCage::Response

```

This method, as the name suggests, call the API to obtain information about places existing under the specified coordinates (C<$lat> for lattitude, C<$lng> for longtitude). Additional C<%params> can be passed according to the same rules as in the C<geocode()> method.

# AUTHOR

Tadeusz Sośnierz

# COPYRIGHT AND LICENSE

Copyright 2016 - 2017 Tadeusz Sośnierz

Copyright 2024 Raku Community

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


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

# NAME

Slang::Lambda - allow λ as a pointy block starter

# SYNOPSIS

```
use Slang::Lambda;

say (1,2,3).map: λ $x { $x+1 }  # (2 3 4)

```

# DESCRIPTION

Slang::Lambda modifies the Raku grammar to make it possible to use simple the `λ` (lambda) symbol as the starter symbol of a pointy block (which is usually `->`).

# INSPIRATION

A question on [/r/rakulang](https://www.reddit.com/r/rakulang/comments/1idts0a/how_can_i_use_%CE%BB_lambda_for_if_at_all/).

# AUTHOR

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

Source can be located at: <https://github.com/lizmat/Slang-Lambda> . 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 2025 Elizabeth Mattijsen

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


## dist_cpan-TYIL-Config-Parser-toml.md
# Config::Parser::toml

A TOML parser for [Config](https://github.com/scriptkitties/p6-Config).

[![Build Status](https://travis-ci.org/scriptkitties/p6-Config-Parser-toml.svg?branch=master)](https://travis-ci.org/scriptkitties/p6-Config-Parser-toml)

## Installation

```
zef install Config::Parser::toml

```

## Known issues

The dependency `Config::TOML` fails to test on Rakudo 2017.03. As such,
you will need to use Rakudo 2017.04 or higher in order to use this module.

## License

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

This program 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 General Public License for more details.

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


## get.md
get

Combined from primary sources listed below.

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

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

```raku
multi get  (IO::Handle:D $fh = $*ARGFILES) { $fh.get  }
```

This routine is a wrapper for the [method of the same name in `IO::Handle`](/type/IO/Handle#routine_get). If no `Handle` is specified, defaults to [`$*ARGFILES`](/language/variables#$*ARGFILES).

# [In IO::Socket::INET](#___top "go to top of document")[§](#(IO::Socket::INET)_method_get "direct link")

See primary documentation
[in context](/type/IO/Socket/INET#method_get)
for **method get**.

```raku
method get()
```

Reads a line from the socket and returns it as of type [`Str`](/type/Str). Return [`Nil`](/type/Nil) on end-of-file (EOF).

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

See primary documentation
[in context](/type/IO/Handle#routine_get)
for **routine get**.

```raku
method get(IO::Handle:D: --> Str:D)
multi  get (IO::Handle $fh = $*ARGFILES --> Str:D)
```

Reads a single line of input from the handle, removing the trailing newline characters (as set by [`.nl-in`](/routine/nl-in)) if the handle's `.chomp` attribute is set to `True`. Returns [`Nil`](/type/Nil), if no more input is available. The subroutine form defaults to [`$*ARGFILES`](/language/variables#index-entry-%24%2AARGFILES) if no handle is given.

Attempting to call this method when the handle is [in binary mode](/type/IO/Handle#method_encoding) will result in [`X::IO::BinaryMode`](/type/X/IO/BinaryMode) exception being thrown.

```raku
$*IN.get.say;              # Read one line from the standard input

my $fh = open 'filename';
$fh.get.say;               # Read one line from a file
$fh.close;

say get;                   # Read one line from $*ARGFILES

```

# [In role IO::Socket](#___top "go to top of document")[§](#(role_IO::Socket)_routine_get "direct link")

See primary documentation
[in context](/type/IO/Socket#routine_get)
for **routine get**.

```raku
method get(IO::Socket:D: --> Str:D)
```

Reads a single line of input from the socket, removing the trailing newline characters (as set by [`.nl-in`](/routine/nl-in)). Returns [`Nil`](/type/Nil), if no more input is available.

Fails if the socket is not connected.

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

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

```raku
method get(IO::CatHandle:D: --> Bool:D)
```

Returns a single line of input from the handle, with the new line string defined by the value(s) of [`$.nl-in` attribute](/type/IO/CatHandle#method_nl-in), which will be removed from the line if [`$.chomp` attribute](/type/IO/CatHandle#method_chomp) is set to `True`. Returns [`Nil`](/type/Nil) when there is no more input. It is an error to call this method when the handle is [in binary mode](/type/IO/CatHandle#method_encoding), resulting in [`X::IO::BinaryMode`](/type/X/IO/BinaryMode) exception being thrown.

```raku
(my $f1 = 'foo'.IO).spurt: "a\nb\nc";
(my $f2 = 'bar'.IO).spurt: "d\ne";
my $cat = IO::CatHandle.new: $f1, $f2;
.say while $_ = $cat.get; # OUTPUT: «a␤b␤c␤d␤e␤»

```


## special.md
class IO::Special

Path to special I/O device

```raku
class IO::Special does IO { }

```

Used as a [`$.path`](/type/IO/Handle#method_path) attribute in filehandles for special standard input `$*IN` and output `$*OUT` and `$*ERR`. Provides a bridged interface of [`IO::Handle`](/type/IO/Handle), mostly file tests and stringification.

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

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

```raku
method new(:$!what!)

```

Takes a single required attribute [what](/routine/what). It is unlikely that you will ever need to construct one of these objects yourself.

## [method what](#class_IO::Special "go to top of document")[§](#method_what "direct link")

```raku
say $*IN.path.what;  # OUTPUT: «<STDIN>␤»
say $*OUT.path.what; # OUTPUT: «<STDOUT>␤»
say $*ERR.path.what; # OUTPUT: «<STDERR>␤»
```

Returns one of the strings `'<STDIN>'`, `'<STDOUT>'`, or `'<STDERR>'`, specifying the type of the special IO device.

## [method WHICH](#class_IO::Special "go to top of document")[§](#method_WHICH "direct link")

```raku
method WHICH(IO::Special:D: --> Str)
```

This returns a string that identifies the object. The string is composed by the type of the instance (`IO::Special`) and the `what` attribute:

```raku
$*IN.path.what;  # OUTPUT: «<STDIN>␤»
$*IN.path.WHICH; # OUTPUT: «IO::Special<STDIN>␤»
```

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

```raku
method Str(IO::Special:D:)
```

This returns `'<STDIN>'`, `'<STDOUT>'`, or `'<STDERR>'` as appropriate.

## [method IO](#class_IO::Special "go to top of document")[§](#method_IO "direct link")

```raku
method IO(IO::Special:D: --> IO::Special)
```

Returns the invocant.

```raku
say $*IN.path.IO.what;  # OUTPUT: «<STDIN>␤»
say $*IN.path.what;     # OUTPUT: «<STDIN>␤»
```

## [method e](#class_IO::Special "go to top of document")[§](#method_e "direct link")

```raku
method e(IO::Special:D: --> True)
```

The 'exists' file test operator, always returns `True`.

## [method d](#class_IO::Special "go to top of document")[§](#method_d "direct link")

```raku
method d(IO::Special:D: --> False)
```

The 'directory' file test operator, always returns `False`.

## [method f](#class_IO::Special "go to top of document")[§](#method_f "direct link")

```raku
method f(IO::Special:D: --> False)
```

The 'file' file test operator, always returns `False`.

## [method s](#class_IO::Special "go to top of document")[§](#method_s "direct link")

```raku
method s(IO::Special:D: --> 0)
```

The 'size' file test operator, always returns `0`.

## [method l](#class_IO::Special "go to top of document")[§](#method_l "direct link")

```raku
method l(IO::Special:D: --> False)
```

The 'symbolic links' file test operator, always returns `False`.

## [method r](#class_IO::Special "go to top of document")[§](#method_r "direct link")

```raku
method r(IO::Special:D: --> Bool)
```

The 'read access' file test operator, returns `True` if and only if this instance represents the standard input handle(`<STDIN>`).

## [method w](#class_IO::Special "go to top of document")[§](#method_w "direct link")

```raku
method w(IO::Special:D: --> Bool)
```

The 'write access' file test operator, returns `True` only if this instance represents either the standard output (`<STOUT>`) or the standard error (`<STDERR>`) handle.

## [method x](#class_IO::Special "go to top of document")[§](#method_x "direct link")

```raku
method x(IO::Special:D: --> False)
```

The 'execute access' file test operator, always returns `False`.

## [method modified](#class_IO::Special "go to top of document")[§](#method_modified "direct link")

```raku
method modified(IO::Special:D: --> Instant)
```

The last modified time for the filehandle. It always returns an [`Instant`](/type/Instant) type object.

## [method accessed](#class_IO::Special "go to top of document")[§](#method_accessed "direct link")

```raku
method accessed(IO::Special:D: --> Instant)
```

The last accessed time for the filehandle. It always returns an [`Instant`](/type/Instant) type object.

## [method changed](#class_IO::Special "go to top of document")[§](#method_changed "direct link")

```raku
method changed(IO::Special:D: --> Instant)
```

The last changed time for the filehandle. It always returns an [`Instant`](/type/Instant) type object.

## [method mode](#class_IO::Special "go to top of document")[§](#method_mode "direct link")

```raku
method mode(IO::Special:D: --> Nil)
```

The mode for the filehandle, it always returns [`Nil`](/type/Nil)


## dist_github-grondilu-SSL.md
## Status

**THIS REPO IS NOT MAINTAINED ANYMORE.**

It is only left public for informative purpose.
The license still applies, though.

## Description

Perl6 interface to OpenSSL. So far only digests (SSL::Digest).

Digests supported include md2, md4, md5, sha0, sha1, sha2 variants (as sha224,
sha256, sha384, sha512), whirlpool, and ripemd160 (as rmd160). These are all
exported by default.

* Whirlpool support was added to openssl in 1.0.0, released in 2010. If your
  openssl lacks this support, two tests will fail.
* Note that many of these digests are considered completely insecure (md2, md4,
  md5, sha0).


## dist_github-oposs-JSONHound.md
# jsonHound [Build Status](https://travis-ci.org/oposs/jsonhound)

*a system for parsing JSON data structures and identifying anomalies*

While the name and the structure of this tool is very generic, it was built for a highly specific purpose:
Modern Cisco Switches allow export of their configuration in JSON format. The purpose of the jsonHound is
to identify misconfiguration of the switches. It does that by identifying *interesting* data structures,
like interfaces, and then choosing a set of checks to verify that they are properly configured. The
checks are chosen by looking at features of the interface or the configuration as a whole. For example,
if an interface is part of VLAN 643 we *know* that this is part of your IP Telefony VLAN and will thus
require a particular set of configuration options to be active.

The configuration of the jsonHound works in 3 stages:

* Stage 1 identifies the "interesting structures"
* Stage 2 applies a set of checks to these structures

jsonHound is implemented in in Raku programming language, and Raku is also used to write the jsonHound rule files.

## The jsonHound rule files

A jsonHound rule file is just a Raku module that does `use JsonHound` at the top, and contains
identification and validation setup. It's fine to use Raku language features to help factor out
re-use within the ruleset, and even to spread the rules over multiple modules, and `use` those.

## Identification

The identification state is set up by declaring Raku `subset` types, which pick out "subsets"
of the JSON document to check. The simplest way to identify part of the document that should be
considered is by using JSONPath:

```
subset ArpInspection
        is json-path(q[$['Cisco-IOS-XE-native:native'].ip.arp.inspection.vlan]);

```

A `where` clause can be applied in order to further constrain what is matched, by looking
into the deserialized JSON that was matched by the JSONPath query.

```
subset GigabitEthernet
        is json-path(q[$['Cisco-IOS-XE-native:native'].interface.GigabitEthernet[*]])
        where {
            [&&] .keys > 1,         # Not just a name
                 .<name> ne '0/0',
                 (.<description> // '') ne '__SKIP__'
        }

```

It's also possible to add further constraints (but *not* further JSONPath) using a
derived `subset` type:

```
sub get-vlan($ge) {
    $ge<switchport><Cisco-IOS-XE-switch:access><vlan><vlan>
}
subset VLan31
        of GigabitEthernet
        where { get-vlan($_) == 31 };

```

## Validations

Validations are set up by calling the `validate` sub, passing it a name for the validation
(to be displayed upon failure) and one or more identified document sections. For example:

```
validate 'dot1x-not-set', -> VLan31 $ge {
    $ge<Cisco-IOS-XE-dot1x:dot1x>:exists
}

```

The block should evaluate to a true value if the validation is successful. If it evalutes
to a false value, then validation fails and this will be reported. The JSON that was
matched in the identification phase is passed using the variable declared in the signature.

The `validate` block will be called once for each matching item. In the event that multiple
parameters are specified, then it will be called with the product of them (e.g. all of the
combinations). For example, given:

```
validate 'Missing global DHCP snooping', -> ArpInspection $inspection, GigabitEthernet $ge {
    $ge<switchport><Cisco-IOS-XE-switch:access><vlan><vlan> ~~ any(ranges($inspection))
}
sub ranges($range-list) {
    $range-list.split(',').map({ /(\d+)['-'(\d+)]?/; $1 ?? (+$0 .. +$1) !! +$0 })
}

```

If `ArpInspection` matches 1 time and `GigabitEthernet` matches 4 times, then it will be
called `1 * 4 = 4` times (the most typical use here is to pick out sections to match up
with some global value).

It is possible on report extra information by placing it into the validation rule's name.
This is done by:

1. Passing a block that takes named parameters and uses them to build up the name of the
   rule, which will then be reported. It's neatest to do this using the `$:name` named
   parameter placeholder syntax.
2. In case of validation failure, providing arguments for use in that reporting by passing
   them to the `report` function.

For example:

```
validate {"Wrong reauthentication value (was $:value)"}, -> Authentication $auth {
    my $value = $auth<timer><reauthenticate><value>;
    if $value == 1800 {
        True
    }
    else {
        report :$value;
        False
    }
}

```

However, since `report` returns `False`, simple rules like this may instead be written
as simply:

```
validate {"Wrong reauthentication value (was $:value)"}, -> Authentication $auth {
    my $value = $auth<timer><reauthenticate><value>;
    $value == 1800 or report :$value
}

```

It is allowed to have multiple such parameters, which may be provided with a single
call to `report` or multiple calls to `report` over time. Do as is most comfortable
for the rule being implemented.

## Disjunctions of identifiers

It's possible to use the `Either[...]` construct to produce a disjunction of two
or more identifiers. For example, given:

```
subset MegabitEthernet
        is json-path(q[$['Cisco-IOS-XE-native:native'].interface.MegabitEthernet[*]]);
subset GigabitEthernet
        is json-path(q[$['Cisco-IOS-XE-native:native'].interface.GigabitEthernet[*]]);

```

One could write a validation rule that applies to either by doing:

```
validate 'Ethernet correctly configured', -> Either[MegabitEthernet, GigabitEthernet] $eth {
    ...
}

```

If the same `Either` expression would be repeated multiple times, it may be factored
out by declaring a `constant`:

```
my constant Ethernet = Either[MegabitEthernet, GigabitEthernet];

validate 'Ethernet correctly configured', -> Ethernet $eth {
    ...
}

```

A validation rule using multiple `Either` types will be invoked for all
permutations of matches, as is usually the case with multi-parameter rules.

## The command line interface

Once installed, run with:

```
jsonhound RuleFile.pm6 file1.json file2.json

```

It's possible to read the json data from `STDIN` directly using `-`

```
cat t/03-wrong-reauth.json | jsonhound examples/GigabitEthernetChecks.pm6 -

```

To run it within the repository (e.g. for development), do:

```
raku -Ilib bin/jsonhound RuleFile.pm file1.json file2.json

```

If more than one JSON input file is specified, then they will be parsed and validated
in parallel.

The default is to send a report to STDERR and to exit with 0 if all validation rule
passed, or 1 if there is a validation rule failure. However, this can be controlled
by passing the `--reporter=...` command line option. Valid options are:

* `cli` - the default human-friendly output to STDERR, with exit code 0 or 1 as
  appropriate
* `nagios` - Nagios plugin output and exit code
* `syslog` - Report any validation rule failures to syslog as warnings; has no
  impact on exit code

It is allowed to combine these by listing them comma-separated. However, note that
**the first reporter that provides an exit code will be the one that gets to decide
the exit code**. Thus this:

```
raku -Ilib bin/jsonhound --reporter=nagios,cli,syslog RuleFile.pm file1.json

```

Is probably correct (the `nagios` reporter controls the exit code), while:

```
raku -Ilib bin/jsonhound --reporter=cli,nagios,syslog RuleFile.pm file1.json

```

Is probably not what's wanted (however, in this case one would probably also get
away with it, in so far as `0` and `1` are quite sensible exit codes for a Nagios
plugin anyway).

## Debug messages

To produce a debug message in a validation rule, call `debug` and pass the
message (whatever is passed will be coerced to a string, if it is not one
already).

```
validate 'Missing global DHCP snooping', -> ArpInspection $inspection, GigabitEthernet $ge {
    my $vlan = $ge<switchport><Cisco-IOS-XE-switch:access><vlan><vlan>;
    debug "VLan is $vlan";
    $vlan ~~ any(ranges($inspection))
}

```

By default, these are not reported. However, they can be reported by the
`cli` reporter by passing `--debug=failed` (only report debug output from
failed validation rules) or `--debug=all` (report all debug output).

## Running with Docker

You can also run the tool with docker directly from the git checkout
without installing raku locally.

```
docker-compose build
docker-compose run jsonhound examples/GigabitEthernetChecks.pm6 t/00-Switch1-OK.json

```


## dist_cpan-KOBOLDWIZ-Random-Hawking-Boltzmann.md
# p6-Random-Hawking-Boltzmann

A random number generator based on a Boltzmann function
filling in a Hawking Temperature


## dist_github-kjkuan-Proc-Feed.md
# Introduction

`Proc::Feed` provides a couple wrappers for `Proc::Async` that are
more convenient to use than the `run` and `shell` subs. Specifically, these
wrappers let you easily feed data to them and also from them to other
callables using the feed operator (`==>` or `<==`).

---

## `sub proc`

```
sub proc(
    \command where Str:D|List:D,
    $input? is raw,

    Bool :$check = False,

    :$bin where 'IN' | {! .so} = False,  # i.e., only :bin<IN> or :!bin

    :$stderr where Any|Callable:D|Str:D|IO::Handle:D,

    :$shell where Bool:D|Str:D = False,

    :$cwd = $*CWD,
    Hash() :$env = %*ENV,

    :$scheduler = $*SCHEDULER

    --> Proc:D

) is export(:DEFAULT, :proc);

```

Use the `proc` sub to run a command when you don't need to capture its
output(`STDOUT`):

```
    proc <<ls -la "READ ME.txt">>;

```

Here we passed a list, of which the first element is the executable, while the
rest are arguments passed to the executable.

> **NOTE**: `proc` blocks until the external command is completed and returns
> a `Proc` object, which when sunk throws an exception if the command exited
> with a non-zero status.

It's also possible to redirect `STDERR` if desired:

```
    # Redirect STDERR to /dev/null
    proc <ls whatever>, :stderr('/dev/null/');

    # Same thing; but with a file we opened
    my $black-hole = open('/dev/null', :w);
    proc <ls whatever>, :stderr($black-hole);
    $black-hole.close;

    # Same effect that ignores error messages; this time, with a callable
    # that just ignores the lines from STDERR.
    proc <ls whatever>, :stderr({;});

```

Sometimes it can be convenient to run a command via a shell (defaults to
`/bin/bash`) if you need to use the features (e.g., globbing, I/O redirection,
... etc) it provides:

```
    proc(['ls -la ~/.*'], :shell);

```

One can also simply pass a single string (recommended when using `:shell`)
instead of a list if not passing any arguments to the command from Perl 6:

```
    proc('ls -la ~/.*', :shell);

```

However, if a list is passed, any remaining elements of the list are passed to
the shell as positional arguments, which will be available as `$1`, `$2`, ...,
and so on, in the shell command/script:

```
    proc(['md5sum "$1" | cut -d" " -f1 > "$1.md5"', "$*PROGRAM"], :shell);

    # ~/.* is not expanded here because it will be passed as an argument to bash.
    proc(<<ls -la ~/.*>>, :shell);  # runs:  bash -c 'ls' - bash '-la' '~/.*'

    # prints an empty line
    proc(<<echo hello world>>, :shell)

    # prints hello world
    proc(<<'echo "$@"' hello world>>, :shell)

    # prints the passed args; also shows you can specify the shell to use.
    proc([q:to/EOF/, 'arg1', 'arg2'], :shell</usr/local/bin/bash>);
    echo "Using SHELL - $0"
    echo "First argument is: $1"
    echo "Second argument is: $2"
    EOF

```

---

## `sub capture`

```
sub capture(
    \command where Str:D|List:D,
    $input? is raw,

    Bool :$check = True,
    Bool :$chomp = True,
    Bool :$merge,

    :$bin where 'IN' | {! .so} = False,  # i.e., only :bin<IN> or :!bin

    :$stderr where Any|Callable:D|Str:D|IO::Handle:D,

    :$shell where Bool:D|Str:D = False,

    Str:D :$enc = 'UTF-8',
    Bool :$translate-nl = True,

    :$cwd = $*CWD,
    Hash() :$env = %*ENV,

    :$scheduler = $*SCHEDULER

    --> Str:D

) is export(:DEFAULT, :capture);

```

To capture the `STDOUT` of a command use the `capture` sub, which returns a `Str:D`
instead of a `Proc`:

```
    capture(<<md5sum "$*PROGRAM">>).split(' ')[0] ==> spurt("$*PROGRAM.md5");

    # You can still run command via a shell
    my $ls = capture('ls -la ~/.*', :shell);

    my $err = capture(<<ls -la "doesn't exist">>, :merge);
    #
    # :merge redirects STDERR to STDOUT, so error messages are also
    # captured in this case.

```

> **NOTE**: By default, similar to *command substitution* in Bash, any trailing
> newline of the captured output is removed. You can disable this behavior by
> specifying `:!chomp`.

> **NOTE**: If the command run by `capture` fails with a non-zero exit
> status, an exception will be thrown. You can disable this behavior with
> `:!check`, and in which case, an empty string will be returned if the command
> fails.

You can easily feed iterable inputs to a `capture`: (you can do the same with
`proc` or `pipe` too):

```
    my $data = slurp("$*HOME/.bashrc");
    my $chksum = ($data ==> capture('md5sum')).split(' ')[0];

```

By default, both input and output are assumed to be lines of strings, but you
can specify both to be binary with `:bin`, or only one of which to be binary
with either `:bin<IN>` or `:bin<OUT>`:

> **NOTE**: For `capture` and `proc`, only `:bin<IN>` (default) and `:!bin`
> are possible.

```
    # Binary (Blob) in; string (Str) out.
    my $blob = Blob.new(slurp("/bin/bash", :bin));
    my $chksum = ($blob ==> capture('md5sum', :bin<IN>)).split(' ')[0];

    # String (Str) in; binary (Blob) out.
    # See below for more details on using 'run' and 'pipe'.
    run {
        my $f = "$*HOME/.bashrc";
        my $gzipped = open("$f.gz", :w:bin);
        LEAVE $gzipped.close;
        slurp($f) \
        ==> pipe(<gzip -c>, :bin<OUT>)
        ==> each { spurt $gizpped, :bin }
    }

```

> **NOTE**: It makes no sense to feed from a `proc` (i.e., `proc(…) ==> …`) because
> `proc(…)` returns a `Proc`, which is not iterable.

---

## `sub pipe`

```
sub pipe(
    \command where Str:D|List:D,
    $input? is raw,

    Bool :$chomp is copy,

    :$bin where {
        $_ ~~ Bool:D|'IN'|'OUT' and (
            # if :bin or :bin<OUT> then :chomp shouldn't be specified.
            ! ($_ eq 'OUT' || ($_ ~~ Bool && $_))
            || !$chomp
        )
    } = False,

    :$stderr where Any|Callable:D|Str:D|IO::Handle:D,

    Bool :$merge,

    Str:D :$enc = 'UTF-8',
    Bool :$translate-nl = True,

    :$cwd = $*CWD,
    Hash() :$env = %*ENV,

    :$shell where Bool:D|Str:D = False,

    :$scheduler = $*SCHEDULER

    --> List:D

) is export(:DEFAULT, :pipe);

```

Finally, `pipe` returns an iterable of the output from the `STDOUT` of the
external process, so you can feed it to another callable. By default, text
output is assumed and the output is an iterable of lines. If binary output
is specified, then the output will be an iterable of `Blob`'s.

`pipe` should be used within a `Block` passed to the `run` sub, and it should
not be used at the end of a pipeline where nothing consumes its output. The
`run { ... }` returns the result returned by the run block. Examples:

```
    # Example
    my $chksum = run {
        slurp("/bin/bash", :bin) \
        ==> pipe('gzip', :bin)
        ==> pipe('md5sum', :bin<IN>)
        ==> split(' ')
        ==> *.[0]()
    }

    # Example
    run {
        my $tarball = open("./somedir.tgz", :w);
        LEAVE $tarball.close;
        pipe «ssh my.remote-host.com "tar -czf - ./somedir"», :bin  \
        ==> each { spurt $tarball, $_ }
    }

    # Example
    my $total = run {
        [+] (pipe «find /var/log -type f» ==> map(*.IO.s))
    }

```

You must extract the data you want in the `run` block because `run` terminates
all external processes started by `pipe`'s at the end of the block by sending
them the `SIGCHLD` signal.

> **NOTE**: Subs like `map` and `grep` are lazy by default, so they are not
> suitable to be used at the end of a pipeline, unless you also consume the
> entire pipeline with somethig like the `[+]` operator in the above example.
> To consume a pipeline, you can also assign or feed the pipeline to an array,
> or listify the pipeline by using a `==> @` at the end of the pipeline, or
> feed it to a `proc(...)` that consumes STDIN.

By default, `run` throws a `BrokenPipeline` exception if any of the `pipe`
calls fails or exits with non-zero status, or if an exception is propagated
from the block. You can prevent an exception from being thrown with the
`:!check` option of `run`, in which case it returns a two-element list instead:

```
    my ($result, $err) = run :!check, {
        pipe(<<cat "$*HOME/.bashrc">>) \
        ==> pipe(<gunzip -c>)  # <-- fails because input is not gzipped
        ==> join('')
    }
    if $err {
        put 'Failed decompressing file...';
        say $err;   # $err.gist will show you the errors and stack traces.
    } else {
        put $result;
    }

```

The first item is the return value of the block you passed to `run`; the second
item is a `BrokenPipeline` exception object if there's any.

> **NOTE**: Many code snippets in this doc are made to demo how the various
> functions from this module can be used. They are usually not the most
> efficient way to do the same thing if data have to flow from an external
> process to Perl 6, without any processing, just to flow back to another
> external process. For example, with `run { pipe(<<ls -la>>) ==> proc('nl') }`
> this module currently is not smart enough to connect the `STDOUT` of the first
> process to the `STDIN` of the second process, and therefore the data have to
> go through Perl 6.

## Other helpers

```
sub each(&code, $input? is raw) is export(:each);
multi sub map(Range \range, &code, $input? is raw) is export(:map);

```

`each`, often used for side effects, makes feeding into a block that
just wants to be called for each item of the iterable fed to it easier:

```
# using each:
(1,2,3,4) ==> each { .say }

# without each:
(1,2,3,4) ==> { .say for $_ }()

```

The `map` multi sub exported by this module takes a `Range` parameter so that
you can limit the code to only a certain range of input a block:

```
# using ranged map:
1,1, * + * ... Inf ==> map ^10, { $_ ** 2 }

# without ranged map:
1,1, * + * ... Inf ==> { gather for $_[^10] { take $_ ** 2 } }()

```

```
sub quote(Str $s --> Str) is export(:quote);

```

`quote` will single-quote a string so that it can be used in a shell script/command
literally:

```
my $file = q/someone's file is > than 1GB;
put capture("echo {quote $file}", :shell);

```


## dist_zef-raku-community-modules-Test-Notice.md
[![Tests on source](https://github.com/raku-community-modules/Test-Notice/actions/workflows/test.yaml/badge.svg)](https://github.com/raku-community-modules/Test-Notice/actions/workflows/test.yaml)

# NAME

Test::Notice - Display noticable messages to users during tests

# SYNOPSIS

```
    use Test::Notice;
    notice 'Install Foo::Bar::Baz for extra awesome features!';

    # Do not use colors
    notice 'Now without colors!', :!try-color;

```

# DESCRIPTION

This module lets you display highly visible messages to users during
the run of your test, pausing long enough for them to read it.

![](sample.png)

# EXPORTED SUBROUTINES

## `notice( Str $message, Bool :$try-color = True )`

```
    notice 'Install Foo::Bar::Baz for extra awesome features!';

```

Takes one mandatory argument: the string to display in the message.
Does not return anything meaningful. The message will be coloured if optional
`Terminal::ANSIColor` is installed. The output also pauses long enough
for an average reader to read the entire message (regardless of its length),
unless `NONINTERACTIVE_TESTING` environmental variable is set.

You can turn detection of the coloring module by setting `:try-color` to
`False`.

# LIMITATIONS

The current implementation always assumes the terminal width of 80 characters.
If you can figure out how to get the actual width when test is run with
`prove`, patches are more than welcome.

Currently, any amount of whitespace in the displayed message will be squashed
into a single space.

---

# REPOSITORY

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

# BUGS

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

# AUTHOR

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

Currently maintained by the Raku Community Adoption devs.

# LICENSE

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


## dist_zef-tony-o-Event-Emitter.md
# Event::Emitter

An extendable JS like event emitter but way more fun. Can use supplies or channels and is basically just some syntax sugar on already implemented Perl6 features.

## Syntax

Out of the box functionality

### Single thread

`Event::Emitter` uses a `Supply` in the back end

```
use Event::Emitter;

my Event::Emitter $e .= new;

# hey, i work with regex
$e.on(/^^ "Some regex"/, -> $data {
  qw<do something with your $data here>;
});

# your own callables to match events
my $event = { 'some flag' => 3, 'some other flag' => 5 };
$e.on({ $event<some flag> // Nil eq $*STATE }, -> $data {
  qw<do something with your $data here>;
});

# plain ol strings, just like mom used to make
$e.on('some str', -> $data {
  qw<do something with your $data here>;
});

# runs the some str listener
$e.emit('some str', @(1 .. 5));

# runs the regex because it matches the regex;
$e.emit('Some regex', { conn => IO::Socket::INET });

$e.emit({ 'some flag' => 5 }, { });

```

### Thread

`Event::Emitter` uses a `Channel` in the back end

```
use Event::Emitter;

my Event::Emitter $e .= new(:threaded);

```

## Rolling your own Event::Emitter

Want to make your own receiver/emitter? Here's a template

### Your new .pm6 file

```
use Event::Emitter::Role::Handler;

unit class My::Own::Emitter does Event::Emitter::Role::Handler;

method on($event, $data) {
  qw<do your thing>;
}

method emit($event, $data?) {
  qw<do your thing here>;
}

```

### Later in your .pl6

```
use Event::Emitter;

my $e = Event::Emitter.new(:class<My::Own::Emitter>);

```

# License

Free for all.


## dist_github-finanalyst-Algorithm-Tarjan.md
# p6-Algorithm-Tarjan

A perl6 implementation of Tarjan's algorithm for finding strongly connected components in a directed graph.

More information can be found at wikipedia.org/wiki/Tarjan's\_strongly\_connected\_components\_algorithm.

If there is a cycle, then it will be within a strongly connected component. This implies that the absence of strongly connected components (other than a node with itself) means there are no cycles. It is possible there may be no cycles, but a strongly connected component may still exist (if I have interpreted the theory correctly). I was interested in the absence of cycles.

```
use Algorithm::Tarjan;

my Algorithm::Tarjan $a .= new();

my %h;
# code to fill %h node->[successor nodes]

$a.init(%h);
say 'There are ' ~ $a.find-cycles() ~ ' cycle(s) in the input graph';

```

If there is a need for the sets of strongly connected components, they can be retrieved from $a.strongly-connected (an array of node names).


## dist_cpan-MARTIMM-XML-Actions.md
# XML Actions on every node

[![Build Status](https://travis-ci.org/MARTIMM/XmlActions.svg?branch=master)](https://travis-ci.org/MARTIMM/XmlActions) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/6yaqqq9lgbq6nqot?svg=true&branch=master&passingText=Windows%20-%20OK&failingText=Windows%20-%20FAIL&pendingText=Windows%20-%20pending)](https://ci.appveyor.com/project/MARTIMM/XmlActions/branch/master) [![License](http://martimm.github.io/label/License-label.svg)](http://www.perlfoundation.org/artistic_license_2_0)

## Synopsis

```
use Test;
use XML::Actions;

my Str $file = "a.xml";
$file.IO.spurt(Q:q:to/EOXML/);
  <scxml xmlns="http://www.w3.org/2005/07/scxml"
         version="1.0"
         initial="hello">

    <final id="hello">
      <onentry>
        <log expr="'hello world'" />
      </onentry>
    </final>
  </scxml>
  EOXML

class A is XML::Actions::Work {
  method final:start ( Array $parent-path, :$id ) {
    is $id, 'hello', "final called: id = $id";
    is $parent-path[*-1].name, 'final', 'this node is final';
    is $parent-path[*-2].name, 'scxml', 'parent node is scxml';

  method log:start ( Array $parent-path, :$expr ) {
    is $expr, "'hello world'", "log called: expr = $expr";
    is-deeply @$parent-path.map(*.name), <scxml final onentry log>,
              "<scxml final onentry log> found in parent array";
  }
}

my XML::Actions $a .= new(:$file);
isa-ok $a, XML::Actions, 'type ok';
$a.process(:actions(A.new()));

```

Result would be like

```
ok 1 - type ok
ok 2 - final called: id = hello
ok 3 - this node is final
ok 4 - parent node is scxml
ok 5 - log called: expr = 'hello world'
ok 6 - <scxml final onentry log> found in parent array

```

## Documentation

Users who wish to process **XML::Elements** (from the XML package) must provide an instantiated class which inherits from **XML::Actions::Work**. In that class, methods named after the elements can be defined. Those methods must have `:start` or `:end` attached to have them called when `<someElement>` or `</someElement>` is encountered.

```
class A is XML::Actions::Work {

  method someElement:start ( Array $parent-path, *%attrs --> ActionResult )
  method someElement:end ( Array $parent-path, *%attrs )

  method someOtherElement:start ( Array $parent-path, *%attrs --> ActionResult )
  method someOtherElement:end ( Array $parent-path, *%attrs )
}

```

* The `$parent-path` is an array holding the **XML::Elements** of the parent elements with the root on the first position and the current element on the last.
* The `%*attrs` is a Hash of the found attributes on the element.
* The action may return a ActionResult value. When defined and set to `Truncate`, the caller will not recurse further into this element if there were any.

There are also text-, comment-, cdata- and pi-nodes. They can be processed as

```
  method xml:text ( Array $parent-path, Str $text ) {...}
  method xml:comment ( Array $parent-path, Str $comment ) {...}
  method xml:cdata ( Array $parent-path, Str $cdata ) {...}
  method xml:pi ( Array $parent-path, Str $pi-target, Str $pi-content ) {...}

```

## Large files

When you have to process a large file (e.g. an XML file holding POI data of Turkey from osm planet is about 6.2 Gb), one cannot use the **XML::Actions** module because the DOM tree is build in memory. Since version 0.4.0 the package is extended with module **XML::Actions::Stream** which eats the file in chunks of 128 Kb and chops it up into parseble parts. There will be no check on proper XML because it will slow down too much. You can use other tools for that. There are a few more methods possible to be defined by the user. The arguments to the methods are the same but the first argument, which is an array, has other type of elements.

### User definable methods

The user can define the methods in a class which inherits from **XML::Actions::Stream::Work**. The methods which the user may define are;

* `xml:prolog ( *%prolog-attributes )`. Found only at the start of a document. It might have attributes `version`, `encoding` and/or `standalone`.
* `xml:doctype ( *%doctype-attributes )`. Alsp found only at the start of document. It might have an internal or external DTD. The arguments can be: `Str :$dtd`, `Str :$url`, `Bool :$empty`, `Bool: $public`, `Bool: $system`, `Str :$fpi`. $empty is True when there is no DTD, SYSTEM or PUBLIC defined. $fpi (Formal Public Identifier) should be defined when $public is True. $url should be defined when $system is True but doesn't have to be defined if $public is True.
* `xml:pi ( Str $target, Str $program )`. For `<?target program?>`.
* `xml:comment ( Str $comment-text )`. For `<!-- comment text -->`.
* `xml:cdata ( Str $data )`. For `<[CDATA[ data ]]>`.
* `xml:text ( Str $text )`. All text as content of an element.
* `someElement:start ( Array $parent-path, Bool :$startend, *%element-attributes )`. The named argument `:startend` is a boolean; when `True`, there is no content in this element.
* `someElement:end ( Array $parent-path, *%element-attributes )`

The array is a list of pairs. The key of each pair is the element name and the value is a hash of its attributes. Entry `$parent-path[*-1]` is the currently called element, so its parent is at `*-2`. The root element is at 0 and is always available.

### Changes

One can find the changes document [in ./doc/CHANGES.md](https://github.com/MARTIMM/XmlActions/blob/master/doc/CHANGES.md)

## Installing

Use zef to install the package: `zef install XML::Actions`

## AUTHORS

Current maintainer **Marcel Timmerman** (MARTIMM on github)

## License

**Artistic-2.0**


## dist_zef-pmqs-Archive-SimpleZip.md
# Archive::SimpleZip

Raku (Perl6) module to write Zip archives.

![Linux Build](https://github.com/pmqs/Archive-SimpleZip/actions/workflows/linux.yml/badge.svg)
![MacOS Build](https://github.com/pmqs/Archive-SimpleZip/actions/workflows/macos.yml/badge.svg)
![Windows Build](https://github.com/pmqs/Archive-SimpleZip/actions/workflows/windows.yml/badge.svg)

## Synopsis

```
use Archive::SimpleZip;

# Create a zip file in the filesystem
my $z = SimpleZip.new: "mine.zip";

# Add a file to the zip archive
$z.add: "/some/file.txt";

# Add multiple files in one step
# the 'add' method will consume anything that is an Iterable
$z.add: @list_of_files;

# change the compression method to STORE
$z.add: 'somefile', :method(Zip-CM-Store);

# add knows what to do with IO::Glob
use IO::Glob;
$z.add: glob("*.c");

# add a file, but call it something different in the zip file
$z.add: "/some/file.txt", :name<better-name>;

# algorithmically rename the files by passing code to the name option
# in this instance chage file extension from '.tar.gz' to ;.tgz'
$z.add: @list_of_files, :name( *.subst(/'.tar.gz' $/, '.tgz') ), :method(Zip-CM-Store);

# when used in a method chain it will accept an Iterable and output a Seq of filenames

# add all files matched by IO::Glob
glob("*.c").dir.$z ;

# or like this
glob("*.c").$z ;

# contrived example
glob("*.c").grep( ! *.d).$z.uc.sort.say;

# Create a zip entry from a string/blob

$z.create(:name<data1>, "payload data here");
$z.create(:name<data2>, Blob.new([2,4,6]));

# Drop a filehandle into the zip archive
my $handle = "/another/file".IO.open;
$z.create("data3", $handle);

# use Associative interface to call 'create' behind the secenes
$z<data4> = "more payload";

# can also use Associative interface to add a file from the filesystem
# just make sure it is of type IO
$z<data5> = "/real/file.txt".IO;

# or a filehandle
$z<data5> = $handle;

# create a directory
$z.mkdir: "dir1";

$z.close;

```

## Description

Simple write-only interface to allow creation of Zip files.

See the full documentation at the end of the file `lib/Archive/SimpleZip.rakumod`.

## Installation

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

```
# From the source directory

zef install .

# Remote installation

zef install Archive::SimpleZip

```

## Support

Suggestions/patches are welcome at [Archive-SimpleZip](https://github.com/pmqs/Archive-SimpleZip)

## License

Please see the LICENSE file in the distribution

(C) Paul Marquess 2016-2023


## dist_zef-andinus-lacerta.md
```
                ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                LACERTA
                 Lacerta parses WhatsApp exported logs

                                Andinus
                ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Table of Contents
─────────────────

Installation
Documentation
News

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 Website
 Source
 GitHub (mirror)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Installation
════════════

  Lacerta is released to `fez', you can get it from there or install it
  from source. In any case, `zef' is required to install the
  distribution.

  You can run Lacerta without `zef'. Just run `raku -Ilib bin/lacerta'
  from within the source directory.

Release
───────

  1. Run `zef install lacerta'.

  Lacerta should be installed, try running `lacerta --version' to
  confirm.

From Source
───────────

  You can either download the release archive generated by cgit/GitHub
  or clone the project if you have `git' installed.

Without `git'
╌╌╌╌╌╌╌╌╌╌╌╌╌

  1. Download the release:
     •
     •
  2. Extract the file.
  3. Run `zef install .' in source directory.

With `git'
╌╌╌╌╌╌╌╌╌╌

  All commits will be signed by my [PGP Key].

  ┌────
  │ # Clone the project.
  │ git clone https://git.tilde.institute/andinus/lacerta
  │ cd lacerta
  │
  │ # Install lacerta.
  │ zef install .
  └────

[PGP Key]

Documentation
═════════════

Implementation
──────────────

  It reads the log line by line and tries to match it with `WhatsApp'
  grammar.

Options
───────

input
╌╌╌╌╌

  Exported WhatsApp log.

profile-name
╌╌╌╌╌╌╌╌╌╌╌╌

  Your WhatsApp profile name. This is required to get stats for /Left/
  and /Deleted/ column.

Caveats
───────

  /Words/ count can be less than the actual count. If the message
  contains new lines then they have them in the log too. We read the log
  line by line, so it'll miss parts of messages with newline in them.

News
════

v0.1.0 - 2021-07-29
───────────────────

  Initial Implementation.

```


## pop.md
pop

Combined from primary sources listed below.

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

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

```raku
method pop()
```

Returns and removes the last element of the buffer.

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

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

See primary documentation
[in context](/type/Array#method_pop)
for **method pop**.

```raku
method pop(Array:D:) is nodal
```

Removes and returns the last item from the array. Fails if the array is empty.

Like many `Array` methods, method `pop` may be called via the corresponding [subroutine](/type/independent-routines#sub_pop). For example:

```raku
my @foo = <a b>; # a b
@foo.pop;        # b
pop @foo;        # a
pop @foo;
CATCH { default { put .^name, ': ', .Str } };
# OUTPUT: «X::Cannot::Empty: Cannot pop from an empty Array␤»
```

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

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

```raku
multi pop(@a) is raw
```

Calls method `pop` on the [`Positional`](/type/Positional) argument. That method is supposed to remove and return the last element, or return a [`Failure`](/type/Failure) wrapping an [`X::Cannot::Empty`](/type/X/Cannot/Empty) if the collection is empty.

See the documentation of the [`Array` method](/routine/pop#(Array)_method_pop) for an example.


## atan.md
atan

Combined from primary sources listed below.

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

See primary documentation
[in context](/type/Cool#routine_atan)
for **routine atan**.

```raku
sub atan(Numeric(Cool))
method atan()
```

Coerces the invocant (or in sub form, the argument) to [`Numeric`](/type/Numeric), and returns its [arc-tangent](https://en.wikipedia.org/wiki/Inverse_trigonometric_functions) in radians.

```raku
say atan(3);                # OUTPUT: «1.24904577239825␤»
say 3.atan;                 # OUTPUT: «1.24904577239825␤»
```


## dist_github-azawawi-Net-Curl.md
# Net::Curl

Net::Curl provides a Perl 6 interface to libcurl.
The plan is support the libcurl Easy interface first
and run all the libcurl website examples
and then support an object-oriented interface.

libcurl is a free and easy-to-use client-side URL transfer library.
It supports DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS,
LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet
and TFTP. libcurl supports SSL certificates, HTTP POST, HTTP PUT,
FTP uploading, HTTP form based upload, proxies, cookies,
user+password authentication (Basic, Digest, NTLM, Negotiate, Kerberos),
file transfer resume, http proxy tunneling and more!

## Build Status

| Operating System | Build Status | CI Provider |
| --- | --- | --- |
| Linux / Mac OS X | [Build Status](https://travis-ci.org/azawawi/perl6-net-curl) | Travis CI |
| Windows 7 64-bit | [Build status](https://ci.appveyor.com/project/azawawi/perl6-net-curl/branch/master) | AppVeyor |

## Installation

* Since Net::Curl uses libcurl, libcurl.so must be found in /usr/lib.
  To install libcurl on Debian for example, please use the following command:

```
$ sudo apt-get install libcurl3-dev

```

* On Mac OS X, Please use the following command:

```
$ brew install curl

```

* Using zef (a module management tool bundled with Rakudo Star):

```
$ zef install Net::Curl

```

## Testing

To run tests:

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

```

## Author

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

## License

MIT License


## dist_cpan-TITSUKI-Algorithm-NaiveBayes.md
[![Build Status](https://travis-ci.org/titsuki/raku-Algorithm-NaiveBayes.svg?branch=master)](https://travis-ci.org/titsuki/raku-Algorithm-NaiveBayes)

# NAME

Algorithm::NaiveBayes - A Raku Naive Bayes classifier implementation

# SYNOPSIS

## EXAMPLE1

```
use Algorithm::NaiveBayes;

my $nb = Algorithm::NaiveBayes.new(solver => Algorithm::NaiveBayes::Multinomial);
$nb.add-document("Chinese Beijing Chinese", "China");
$nb.add-document("Chinese Chinese Shanghai", "China");
$nb.add-document("Chinese Macao", "China");
$nb.add-document("Tokyo Japan Chinese", "Japan");
my $model = $nb.train;
my @result = $model.predict("Chinese Chinese Chinese Tokyo Japan");
@result.say; # [China => -8.10769031284391 Japan => -8.90668134500126]

```

## EXAMPLE2

```
use Algorithm::NaiveBayes;

my $nb = Algorithm::NaiveBayes.new(solver => Algorithm::NaiveBayes::Bernoulli);
$nb.add-document("Chinese Beijing Chinese", "China");
$nb.add-document("Chinese Chinese Shanghai", "China");
$nb.add-document("Chinese Macao", "China");
$nb.add-document("Tokyo Japan Chinese", "Japan");
my $model = $nb.train;
my @result = $model.predict("Chinese Chinese Chinese Tokyo Japan");
@result.say; # [Japan => -3.81908500976888 China => -5.26217831993216]

```

# DESCRIPTION

Algorithm::NaiveBayes is a Raku Naive Bayes classifier implementation.

## CONSTRUCTOR

```
my $nb = Algorithm::NaiveBayes.new(); # default solver is Multinomial
my $nb = Algorithm::NaiveBayes.new(%options);

```

### OPTIONS

* `solver => Algorithm::NaiveBayes::Multinomial|Algorithm::NaiveBayes::Bernoulli`

## METHODS

### add-document

```
multi method add-document(%attributes, Str $label)
multi method add-document(Str @words, Str $label)
multi method add-document(Str $text, Str $label)

```

Adds a document used for training. `%attributes` is the key-value pair, where key is the word and value is the frequency of occurrence of the word in the document. `@words` is the bag-of-words. The bag-of-words is represented as a multiset of words occurrence in the document. `$text` is the plain text of the document. It will be splitted by whitespaces and processed as the bag-of-words internally.

### train

```
method train(--> Algorithm::NaiveBayes::Model)

```

Starts training and returns an Algorithm::NaiveBayes::Model instance.

# AUTHOR

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

# COPYRIGHT AND LICENSE

Copyright 2016 titsuki

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

This algorithm is from Manning, Christopher D., Prabhakar Raghavan, and Hinrich Schutze. Introduction to information retrieval. Vol. 1. No. 1. Cambridge: Cambridge university press, 2008.


## stubcode.md
class X::StubCode

Runtime error due to execution of stub code

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

Thrown when a piece of stub code (created via `!!!` or `...`) is executed.

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

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

Returns the custom message provided to `!!!`, or a reasonable default if none was provided.


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

# NAME

Net::Telnet - TELNET library for clients and servers

# SYNOPSIS

```
use Net::Telnet::Client;
use Net::Telnet::Constants;
use Net::Telnet::Server;

my Net::Telnet::Client $client .= new:
    :host<telehack.com>,
    :preferred[NAWS],
    :supported[SGA, ECHO];
$client.text.tap({ .print });

await $client.connect;
await $client.send-text: 'cowsay ayy lmao';
$client.close;

my Net::Telnet::Server $server .= new:
    :host<localhost>,
    :preferred[SGA, ECHO],
    :supported[NAWS];

react {
    whenever $server.listen -> $connection {
        $connection.text.tap(-> $text {
            say "{$connection.host}:{$connection.port} sent '$text'";
            $connection.close;
        }, done => {
            # Connection was closed; clean up if necessary.
        });

        LAST {
            # Server was closed; clean up if necessary.
        }

        QUIT {
            # Handle exceptions.
        }
    }
    whenever signal(SIGINT) {
        $server.close;
    }
}

```

# DESCRIPTION

`Net::Telnet` is a library for creating TELNET clients and servers.

Before you get started, read the documentation in the `docs` directory and read the example code in the `examples` directory.

If you are using `Net::Telnet::Client` and don't know what options the server will attempt to negotiate with, run `bin/p6telnet-grep-options` using the server's host and port to grep the list of options it attempts to negotiate with when you first connect to it.

The following options are currently supported:

* TRANSMIT\_BINARY
* SGA
* ECHO
* NAWS

# AUTHOR

Ben Davies (Kaiepi)

# COPYRIGHT AND LICENSE

Copyright 2018 Ben Davies

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


## dist_cpan-KOBOLDWIZ-Game-Stats.md
This software is a minimal statistics package which includes probabiltiy
calculation based on populations which sometimes are a Distribution themselves.

It is to be used in games and was built for speed not general OOP.

Features are populations and distributions of probabilities wherefor an
estimate and variance can be calculated. A Covariance class provides with
2 populations the covariance. The same works for a correlation.
There is also a Probability class which uses a population of probabilities
and calculates conditional probabilities and thus a multi-variate Bayes
method. You can access the nth probability in this case and work on
towards Bayesian Inference.

Examples:
my $pp = 0.1; ### start probability
my $pop = Mathx::Stat::DistributionPopulation.new; ### list of probabilties

my @plist;
my @indices;

### We fill the distributionpopulation with probabilities

loop (my $i = $pp, my $j = 0; $i <= 1.0; $i+=0.1, $j++) {
$pop.add($i);
push(@plist, $i);
push(@indices, $j);
}

$pop.Expectance; ### yields 0.55

$pop.Variance; ## yields the variance of the probabilties in the population

$pop.GeneratedNumber ### yields a marginal distribution number based on population

my $cov = Mathx::Stat::Covariance.new;
my $corr = Mathx::Stat::Correlation.new;

### calculation of covariance and correlation

$cov.Covariance($pop,$pop);

$corr.Correlation($pop,$pop);

### make a multi-variate probability instance (again based on a population list)

my $p = Mathx::Stat::Probability.new(xpop => @plist);

### calculate Bayes on several indexed probabilities a conditional

### probability list and the index of the precondition probability

$p.Bayes(@indices, @plist, 1);

$p.Bayes(@indices, @plist, 0);

### caculate conditional probabilities (1-dimensional) of 2 indexed

### probabilities in the population ofthe variable $p

$p.CalculatedCondP(3,0);

$p.CalculatedCondP(7,4);


## int.md
Int

Combined from primary sources listed below.

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

See primary documentation
[in context](/type/List#method_Int)
for **method Int**.

```raku
method Int(List:D: --> Int:D)
```

Returns the number of elements in the list (same as `.elems`).

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

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

See primary documentation
[in context](/type/Num#method_Int)
for **method Int**.

```raku
method Int(Num:D:)
```

Converts the number to an [`Int`](/type/Int). [Fails](/routine/fail) with `X::Numeric::CannotConvert` if the invocant [is a `NaN`](/routine/isNaN) or `Inf`/`-Inf`. No [rounding](/routine/round) is performed.

# [In enum Bool](#___top "go to top of document")[§](#(enum_Bool)_routine_Int "direct link")

See primary documentation
[in context](/type/Bool#routine_Int)
for **routine Int**.

```raku
multi method Int(Bool:D --> Int:D)
```

Returns the value part of the `enum` pair.

```raku
say False.Int;                                # OUTPUT: «0␤»
say True.Int;                                 # OUTPUT: «1␤»
```

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

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

```raku
method Int
```

Returns the integer value of the `IntStr`.

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

See primary documentation
[in context](/type/Match#method_Int)
for **method Int**.

```raku
method Int(Match:D: --> Int:D)
```

Tries to convert stringified result of the matched text into Int.

```raku
say ('12345' ~~ /234/).Int;       # OUTPUT: «234␤»
say ('12345' ~~ /234/).Int.^name; # OUTPUT: «Int␤»
# the next line produces a warning about using Nil (result of a no match) in numeric context
say ('one-two' ~~ /234/).Int;     # OUTPUT: «0␤» # because Nil.Int returns 0
```

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

See primary documentation
[in context](/type/Str#method_Int)
for **method Int**.

```raku
method Int(Str:D: --> Int:D)
```

Coerces the string to [`Int`](/type/Int), using the same rules as [`Str.Numeric`](/type/Str#method_Numeric).

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

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

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

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

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

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

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

See primary documentation
[in context](/type/StrDistance#method_Int)
for **method Int**.

```raku
multi method Int(StrDistance:D:)
```

Returns the distance between the string before and after the transformation.

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

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

```raku
method Int(Map:D: --> Int:D)
```

Returns the number of pairs stored in the `Map` (same as `.elems`).

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

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

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

```raku
method Int(IO::Path:D: --> Int:D)
```

Coerces [`.basename`](/routine/basename) to [`Int`](/type/Int). [Fails](/routine/fail) with [`X::Str::Numeric`](/type/X/Str/Numeric) if base name is not numerical.

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

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

```raku
method Int(Real:D:)
```

Calls the [`Bridge` method](/routine/Bridge) on the invocant and then the [`Int` method](/routine/Int) on its return value.

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

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

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

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

Available as of release 2023.02 of the Rakudo compiler.

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

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

```raku
multi method Int()
```

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

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

# [In role Rational](#___top "go to top of document")[§](#(role_Rational)_method_Int "direct link")

See primary documentation
[in context](/type/Rational#method_Int)
for **method Int**.

```raku
method Int(Rational:D: --> Int:D)
```

Coerces the invocant to [`Int`](/type/Int) by truncating non-whole portion of the represented number, if any. If the [denominator](/routine/denominator) is zero, will [fail](/routine/fail) with [`X::Numeric::DivideByZero`](/type/X/Numeric/DivideByZero).


## blob.md
role Blob

Immutable buffer for binary data ('Binary Large OBject')

```raku
role Blob[::T = uint8] does Positional[T] does Stringy { }
```

The `Blob` role is an immutable interface to binary types, and offers a list-like interface to lists of integers, typically unsigned integers.

However, it's a parameterized type, and you can instantiate with several integer types:

```raku
my $b = Blob[int32].new(3, -3, 0xff32, -44);
say $b; # OUTPUT: «Blob[int32]:0x<03 -3 FF32 -2C>␤»

```

By default, `Blob` uses 8-bit unsigned integers, that is, it is equivalent to Blob[uint8]. Some other types of `Blob`s which are used often get their own class name.

|  |  |
| --- | --- |
| blob8 | Blob[uint8] |
| blob16 | Blob[uint16] |
| blob32 | Blob[uint32] |
| blob64 | Blob[uint64] |

You can use these in pretty much the same way you would with `Blob`:

```raku
my $blob = blob8.new(3, 6, 254);
say $blob; # OUTPUT: «Blob[uint8]:0x<03 06 FE>␤»
```

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

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

```raku
multi method new(Blob:)
multi method new(Blob: Blob:D $blob)
multi method new(Blob: int @values)
multi method new(Blob: @values)
multi method new(Blob: *@values)
```

Creates an empty `Blob`, or a new `Blob` from another `Blob`, or from a list of integers or values (which will have to be coerced into integers):

```raku
my $blob = Blob.new([1, 2, 3]);
say Blob.new(<1 2 3>); # OUTPUT: «Blob:0x<01 02 03>␤»
```

## [method Bool](#role_Blob "go to top of document")[§](#method_Bool "direct link")

```raku
multi method Bool(Blob:D:)
```

Returns `False` if and only if the buffer is empty.

```raku
my $blob = Blob.new();
say $blob.Bool; # OUTPUT: «False␤»
$blob = Blob.new([1, 2, 3]);
say $blob.Bool; # OUTPUT: «True␤»
```

## [method Capture](#role_Blob "go to top of document")[§](#method_Capture "direct link")

```raku
method Capture(Blob:D:)
```

Converts the object to a [`List`](/type/List) which is, in turn, coerced to a [`Capture`](/type/Capture).

## [method elems](#role_Blob "go to top of document")[§](#method_elems "direct link")

```raku
multi method elems(Blob:D:)
```

Returns the number of elements of the buffer.

```raku
my $blob = Blob.new([1, 2, 3]);
say $blob.elems; # OUTPUT: «3␤»
```

## [method bytes](#role_Blob "go to top of document")[§](#method_bytes "direct link")

```raku
method bytes(Blob:D: --> Int:D)
```

Returns the number of bytes used by the elements in the buffer.

```raku
say Blob.new([1, 2, 3]).bytes;      # OUTPUT: «3␤»
say blob16.new([1, 2, 3]).bytes;    # OUTPUT: «6␤»
say blob64.new([1, 2, 3]).bytes;    # OUTPUT: «24␤»
```

## [method chars](#role_Blob "go to top of document")[§](#method_chars "direct link")

```raku
method chars(Blob:D:)
```

Throws [`X::Buf::AsStr`](/type/X/Buf/AsStr) with `chars` as payload.

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

```raku
multi method Str(Blob:D:)
```

Throws [`X::Buf::AsStr`](/type/X/Buf/AsStr) with [`Str`](/type/Str) as payload. In order to convert to a [`Str`](/type/Str) you need to use [`.decode`](/routine/decode).

## [method Stringy](#role_Blob "go to top of document")[§](#method_Stringy "direct link")

```raku
multi method Stringy(Blob:D:)
```

Throws [`X::Buf::AsStr`](/type/X/Buf/AsStr) with [`Stringy`](/type/Stringy) as payload.

## [method decode](#role_Blob "go to top of document")[§](#method_decode "direct link")

```raku
multi method decode(Blob:D: $encoding = self.encoding // "utf-8")
```

```raku
multi method decode(Blob:D: $encoding, Str :$replacement!,
                    Bool:D :$strict = False)

```

```raku
multi method decode(Blob:D: $encoding, Bool:D :$strict = False)
```

Applies an encoding to turn the blob into a [`Str`](/type/Str); the encoding will be UTF-8 by default.

```raku
my Blob $blob = "string".encode('utf-8');
say $blob.decode('utf-8'); # OUTPUT: «string␤»
```

On malformed utf-8 `.decode` will throw X::AdHoc. To handle sloppy utf-8 use [`utf8-c8`](/language/unicode#UTF8-C8).

## [method list](#role_Blob "go to top of document")[§](#method_list "direct link")

```raku
multi method list(Blob:D:)
```

Returns a [`List`](/type/List) of integers:

```raku
say "zipi".encode("ascii").list; # OUTPUT: «(122 105 112 105)␤»
```

## [method gist](#role_Blob "go to top of document")[§](#method_gist "direct link")

```raku
method gist(Blob:D: --> Str:D)
```

Returns the string containing the "gist" of the `Blob`, **listing up to the first 100** elements, separated by space, appending an ellipsis if the `Blob` has more than 100 elements.

```raku
put Blob.new(1, 2, 3).gist; # OUTPUT: «Blob:0x<01 02 03>␤»
put Blob.new(1..2000).gist;
# OUTPUT:
# Blob:0x<01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15
# 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C
# 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43
# 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A
# 5B 5C 5D 5E 5F 60 61 62 63 64 ...>
```

## [method subbuf](#role_Blob "go to top of document")[§](#method_subbuf "direct link")

```raku
multi method subbuf(Int $from, Int $len = self.elems --> Blob:D)
multi method subbuf(Range $range --> Blob:D)
multi method subbuf(Blob:D: &From)
multi method subbuf(Blob:D: Int:D $From, &End)
multi method subbuf(Blob:D: &From, &End)
multi method subbuf(Blob:D: \from, Whatever)
multi method subbuf(Blob:D: \from, Numeric \length)
```

Extracts a part of the invocant buffer, starting from the index with elements `$from`, and taking `$len` elements (or less if the buffer is shorter), and creates a new buffer as the result.

```raku
say Blob.new(1..10).subbuf(2, 4);    # OUTPUT: «Blob:0x<03 04 05 06>␤»
say Blob.new(1..10).subbuf(*-2);     # OUTPUT: «Blob:0x<09 0a>␤»
say Blob.new(1..10).subbuf(*-5,2);   # OUTPUT: «Blob:0x<06 07>␤»
```

For convenience, also allows a [`Range`](/type/Range) to be specified to indicate which part of the invocant buffer you would like:

```raku
say Blob.new(1..10).subbuf(2..5);    # OUTPUT: «Blob:0x<03 04 05 06>␤»
```

## [method allocate](#role_Blob "go to top of document")[§](#method_allocate "direct link")

```raku
multi method allocate(Blob:U: Int:D $elements)
multi method allocate(Blob:U: Int:D $elements, int $value)
multi method allocate(Blob:U: Int:D $elements, Int:D \value)
multi method allocate(Blob:U: Int:D $elements, Mu:D $got)
multi method allocate(Blob:U: Int:D $elements, int @values)
multi method allocate(Blob:U: Int:D $elements, Blob:D $blob)
multi method allocate(Blob:U: Int:D $elements, @values)
```

Returns a newly created `Blob` object with the given number of elements. Optionally takes a second argument that indicates the pattern with which to fill the `Blob`: this can be a single (possibly native) integer value, or any [`Iterable`](/type/Iterable) that generates integer values, including another `Blob`. The pattern will be repeated if not enough values are given to fill the entire `Blob`.

```raku
my Blob $b0 = Blob.allocate(10,0);
$b0.say; # OUTPUT: «Blob:0x<00 00 00 00 00 00 00 00 00 00>␤»
```

If the pattern is a general [`Mu`](/type/Mu) value, it will fail.

## [routine unpack](#role_Blob "go to top of document")[§](#routine_unpack "direct link")

This method is considered **experimental**, in order to use it you will need to do:

```raku
use experimental :pack;

multi method unpack(Blob:D: Str:D $template)
multi method unpack(Blob:D: @template)
multi        unpack(Blob:D \blob, Str:D $template)
multi        unpack(Blob:D \blob, @template)
```

Extracts features from the blob according to the template string, and returns them as a list.

The template string consists of zero or more units that begin with an ASCII letter, and are optionally followed by a quantifier. The quantifier can be `*` (which typically stands for "use up the rest of the Blob here"), or a positive integer (without a `+`).

Whitespace between template units is ignored.

Examples of valid templates include `"A4 C n*"` and `"A*"`.

The following letters are recognized:

| Letter | Meaning |
| --- | --- |
| A | Extract a string, where each element of the Blob maps to a codepoint |
| a | Same as 'A' |
| C | Extract an element from the blob as an integer |
| H | Extracts a hex string |
| L | Extracts four elements and returns them as a single unsigned integer |
| n | Extracts two elements and combines them in "network" (BigEndian) byte order into a single integer |
| N | Extracts four elements and combines them in "network" (BigEndian) byte order into a single integer |
| S | Extracts two elements and returns them as a single unsigned integer |
| v | Same as 'S' |
| V | Same as 'L' |
| x | Drop an element from the blob (that is, ignore it) |
| Z | Same as 'A' |

Example:

```raku
use experimental :pack;
say Blob.new(1..10).unpack("C*");
# OUTPUT: «(1 2 3 4 5 6 7 8 9 10)␤»
```

## [sub pack](#role_Blob "go to top of document")[§](#sub_pack "direct link")

This subroutine is considered **experimental**, in order to use it you will need to do:

```raku
use experimental :pack;

```

```raku
multi pack(Str $template, *@items)
multi pack(@template, *@items)

```

Packs the given items according to the template and returns a buffer containing the packed bytes.

The template string consists of zero or more units that begin with an ASCII letter, and are optionally followed by a quantifier. For details, see [unpack](/routine/unpack).

## [method reverse](#role_Blob "go to top of document")[§](#method_reverse "direct link")

```raku
method reverse(Blob:D: --> Blob:D)
```

Returns a Blob with all elements in reversed order.

```raku
say Blob.new([1, 2, 3]).reverse;    # OUTPUT: «Blob:0x<03 02 01>␤»
say blob16.new([2]).reverse;        # OUTPUT: «Blob[uint16]:0x<02>␤»
say blob32.new([16, 32]).reverse;   # OUTPUT: «Blob[uint32]:0x<20 10>␤»
```

# [Methods on blob8 only (6.d, 2018.12 and later)](#role_Blob "go to top of document")[§](#Methods_on_blob8_only_(6.d,_2018.12_and_later) "direct link")

These methods are available on the blob8 (and `buf8`) types only. They allow low level access to reading bytes from the underlying data and interpreting them in different ways with regards to type (integer or floating point (num)), size (8, 16, 32, 64 or 128 bits), signed or unsigned (for integer values) and endianness (native, little and big endianness). The returned values are always expanded to a 64 bit native value where possible, and to a (big) integer value if that is not possible.

Endianness must be indicated by using values of the [`Endian`](/type/Endian) enum as the **second** parameter to these methods. If no endianness is specified, `NativeEndian` will be assumed. Other values are `LittleEndian` and `BigEndian`.

## [method read-uint8](#role_Blob "go to top of document")[§](#method_read-uint8 "direct link")

```raku
method read-uint8(blob8:D: uint $pos, $endian = NativeEndian --> uint)
```

Returns an unsigned native integer value for the byte at the given position. The `$endian` parameter has no meaning, but is available for consistency.

## [method read-int8](#role_Blob "go to top of document")[§](#method_read-int8 "direct link")

```raku
method read-int8(blob8:D: uint $pos, $endian = NativeEndian --> int)
```

Returns a native `int` value for the byte at the given position. The `$endian` parameter has no meaning, but is available for consistency.

## [method read-uint16](#role_Blob "go to top of document")[§](#method_read-uint16 "direct link")

```raku
method read-uint16(blob8:D: uint $pos, $endian = NativeEndian --> uint)
```

Returns a native `uint` value for the **two** bytes starting at the given position.

## [method read-int16](#role_Blob "go to top of document")[§](#method_read-int16 "direct link")

```raku
method read-int16(blob8:D: uint $pos, $endian = NativeEndian --> int)
```

Returns a native `int` value for the **two** bytes starting at the given position.

## [method read-uint32](#role_Blob "go to top of document")[§](#method_read-uint32 "direct link")

```raku
method read-uint32(blob8:D: uint $pos, $endian = NativeEndian --> uint)
```

Returns a native `uint` value for the **four** bytes starting at the given position.

## [method read-int32](#role_Blob "go to top of document")[§](#method_read-int32 "direct link")

```raku
method read-int32(blob8:D: uint $pos, $endian = NativeEndian --> int)
```

Returns a native `int` value for the **four** bytes starting at the given position.

## [method read-uint64](#role_Blob "go to top of document")[§](#method_read-uint64 "direct link")

```raku
method read-uint64(blob8:D: uint $pos, $endian = NativeEndian --> UInt:D)
```

Returns an unsigned integer value for the **eight** bytes starting at the given position.

## [method read-int64](#role_Blob "go to top of document")[§](#method_read-int64 "direct link")

```raku
method read-int64(blob8:D: uint $pos, $endian = NativeEndian --> int)
```

Returns a native `int` value for the **eight** bytes starting at the given position.

## [method read-uint128](#role_Blob "go to top of document")[§](#method_read-uint128 "direct link")

```raku
method read-uint128(blob8:D: uint $pos, $endian = NativeEndian --> UInt:D)
```

Returns an unsigned integer value for the **sixteen** bytes starting at the given position.

## [method read-int128](#role_Blob "go to top of document")[§](#method_read-int128 "direct link")

```raku
method read-int128(blob8:D: uint $pos, $endian = NativeEndian --> Int:D)
```

Returns an integer value for the **sixteen** bytes starting at the given position.

## [method read-num32](#role_Blob "go to top of document")[§](#method_read-num32 "direct link")

```raku
method read-num32(blob8:D: uint $pos, $endian = NativeEndian --> int)
```

Returns a native `num` value for the **four** bytes starting at the given position.

## [method read-num64](#role_Blob "go to top of document")[§](#method_read-num64 "direct link")

```raku
method read-num64(blob8:D: uint $pos, $endian = NativeEndian --> int)
```

Returns a native `num` value for the **eight** bytes starting at the given position.

# [Methods on blob8 only (6.d, 2019.03 and later)](#role_Blob "go to top of document")[§](#Methods_on_blob8_only_(6.d,_2019.03_and_later) "direct link")

## [method read-ubits](#role_Blob "go to top of document")[§](#method_read-ubits "direct link")

```raku
method read-ubits(blob8:D: uint $pos, uint $bits --> UInt:D)
```

Returns an unsigned integer value for the **bits** from the given **bit** offset and given number of bits. The endianness of the bits is assumed to be `BigEndian`.

## [method read-bits](#role_Blob "go to top of document")[§](#method_read-bits "direct link")

```raku
method read-bits(blob8:D: uint $pos, uint $bits --> Int:D)
```

Returns a signed integer value for the **bits** from the given **bit** offset and given number of bits. The endianness of the bits is assumed to be `BigEndian`.

## [method Buf](#role_Blob "go to top of document")[§](#method_Buf "direct link")

```raku
method Buf(Blob:D: --> Buf:D)
```

Available as of the 2021.06 Rakudo compiler release.

Coerces the invocant into a mutable [`Buf`](/type/Buf) object.

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

Type relations for `Blob`

raku-type-graph

Blob
Blob

Positional
Positional

Blob->Positional

Stringy
Stringy

Blob->Stringy

Buf
Buf

Buf->Blob

Mu
Mu

Any
Any

Any->Mu

utf8
utf8

utf8->Blob

utf8->Any

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


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

# NAME

Supply::Folds - Alternative fold methods for Supply

# SYNOPSIS

```
# Let's say we want to parse payloads from a TCP connection:
my Supply:D $connection = supply {
    emit 'fo';
    emit 'obarb';
    emit 'azf';
    emit 'ooba';
    emit 'rbazfooba';
    emit 'rbaz';
    done;
};

# It's not guaranteed that these payloads will be complete messages, so our
# parser needs to keep context for where it is in the stream of payloads...
grammar Connection::Grammar {
    token TOP { ( foo | bar | baz )+ }
}
class Connection::Actions {
    method TOP($/) { make $0».Str }
}

# ...but this is a problem! We don't want locks slowing down communication with
# our peer, but we need to hold on to our parser as we parse each payload
# received! Psych, this isn't a problem with Supply.scan:
react whenever $connection.scan: &parse-payload, Connection::Grammar {
    .made.say;
    # OUTPUT:
    # Nil
    # [foo bar]
    # [baz]
    # [foo]
    # [bar baz foo]
    # [bar baz]
}

proto sub parse-payload(Connection::Grammar:_, Str:D --> Connection::Grammar:D) {*}
multi sub parse-payload(Connection::Grammar:U $acc, Str:D $payload --> Connection::Grammar:D) {
    $acc.subparse: $payload, actions => Connection::Actions.new;
}
multi sub parse-payload(Connection::Grammar:D $acc, Str:D $payload --> Connection::Grammar:D) {
    $acc.subparse: $acc.orig.substr(max $acc.pos, 0) ~ $payload, actions => $acc.actions
}

```

# DESCRIPTION

Supply::Folds is a library that provides the `Supply.fold` and `Supply.scan` methods, which can be used as an alternative to `Supply.reduce` and `Supply.produce`. The main advantage these methods have over those is that they may optionally take an initial value to begin a fold/scan with, rather than only working using values emitted by the supply.

# METHODS

## method fold

```
method fold(::?CLASS:D: &folder is raw --> ::?CLASS:D)

```

Alias for `Supply.reduce`.

```
method fold(::?CLASS:D: &folder is raw, $init is raw --> ::?CLASS:D)

```

Using `$init` as the initial result of the fold, for each value emitted from `self`, call `&folder` with the previous result and the value emitted, setting the result to the return value. This will be emitted once the supply is done.

## method scan

```
method scan(::?CLASS:D: &scanner is raw --> ::?CLASS:D)

```

Alias for `Supply.produce`.

```
method scan(::?CLASS:D: &scanner is raw, $init is raw, Bool:D :$keep = False --> ::?CLASS:D)

```

Using `$init` as the initial result of the scan, for each value emitted from `self`, call `&scanner` with the previous result and the value emitted, setting the result to the return value and emitting it. If `$keep` is set to `True`, `$init` will be emitted before the scan starts.

# AUTHOR

Ben Davies (Kaiepi)

# COPYRIGHT AND LICENSE

Copyright 2020 Ben Davies

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


## complex.md
Complex

Combined from primary sources listed below.

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

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

```raku
multi method Complex()
```

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

```raku
say 1+1i.Complex;         # OUTPUT: «1+1i␤»
say π.Complex;            # OUTPUT: «3.141592653589793+0i␤»
say <1.3>.Complex;        # OUTPUT: «1.3+0i␤»
say (-4/3).Complex;       # OUTPUT: «-1.3333333333333333+0i␤»
say "foo".Complex.^name;  # OUTPUT: «Failure␤»
```

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

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

```raku
method Complex
```

Returns the [`Complex`](/type/Complex) value of the `ComplexStr`.

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

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

```raku
method Complex(Real:D: --> Complex:D)
```

Converts the number to a [`Complex`](/type/Complex) with the number converted to a [`Num`](/type/Num) as its real part and 0e0 as the imaginary part.


## dist_cpan-SPIGELL-Sparky-Plugin-Notify-Telegram.md
# SYNOPSIS

Sparky plugin to send notifications in a Telegram chat after completing your builds.
Based on a perl6 module - [TelegramBot](https://github.com/GildedHonour/TelegramBot)

# INSTALL

```
$ zef install Sparky::Plugin::Notify::Telegram

```

# USAGE

```
$ cat sparky.yaml
# send me a notifications on failed builds
plugins:
- Sparky::Plugin::Notify::Telegram:
  run_scope: fail
  parameters:
    token: "111:222" # Your token
    id: "1123213"
    message: "Some fails while processing your build"

```

# Author

Spigell


## dist_zef-finanalyst-GTK-Simple.md
![badge](https://github.com/finanalyst/GTK-Simple/actions/workflows/test.yaml/badge.svg)

## GTK::Simple

GTK::Simple is a set of simple [GTK 3](http://www.gtk.org/) bindings using
NativeCall. Only some GTK widgets are currently implemented. However, these are
enough to create a reasonable interactive GUI for an idiomatic Raku program.

The GTK Widgets in this distribution include the following:

| Widget | Description |
| --- | --- |
| ActionBar | Group multiple buttons and arrange in 'left', 'middle', and 'right' |
| Button | A simple button with a label and a callback |
| Calendar | A calendar for selecting a date |
| CheckButton | A check button with a label |
| CheckMenuItem | A checkable menu item |
| ComboBoxText | A simple combo box |
| DrawingArea | A drawing area (requires the 'Cairo' module) |
| Entry | Allows for text to be provided by the user |
| FileChooserButton | A button that opens a file chooser dialog |
| Frame | A bin with a decorative frame and optional label |
| Grid | A table-like container for widgets for window design |
| Label | Adds a line of text |
| LevelBar | A bar that can used as a level indicator |
| LinkButton | Create buttons bound to a URL |
| ListBox | A vertical listbox where each row is selectable |
| MarkUpLabel | Adds text with GTK mark up (e.g. color and font manipulation) |
| Menu | A simple menu with a menu item label |
| MenuBar | A simple menu bar that contain one or more menus |
| MenuItem | A simple menu item that can have a sub menu |
| MenuToolButton | A menu tool button with a label or an icon |
| PlacesSidebar | Sidebar that displays frequently-used places in the file system |
| ProgressBar | Show progress via a filling bar |
| Scale | Allows for a number to be provided by the user |
| ScrolledWindow | Container for widgets needing scrolling, eg., multiline texts |
| RadioButton | A choice from multiple radio buttons |
| Spinner | Showing that something is happening |
| TextView | Adds multiple lines of text |
| ToggleButton | A toggle-able button |
| Toolbar | A tool bar that can contain one or more menu tool buttons |
| VBox, HBox | Widget containers which enable window layout design |

## Example

```
use GTK::Simple;

my $app = GTK::Simple::App.new( title => "Hello GTK!" );

$app.set-content(
    GTK::Simple::VBox.new(
        my $button = GTK::Simple::Button.new(label => "Hello World!"),
        my $second = GTK::Simple::Button.new(label => "Goodbye!")
    )
);

$app.border-width = 20;
$second.sensitive = False;
$button.clicked.tap({ .sensitive = False; $second.sensitive = True });
$second.clicked.tap({ $app.exit; });
$app.run;

```

### Using :subs option

Another approach is to specify `:subs` on import. This provides subroutine aliases for the constructors
of all of the available `GTK::Simple` widgets, converted from CamelCase to kebab-case.

`GTK::Simple::MenuToolButton` becomes `menu-tool-button`, `GTK::Simple::ProgressBar` becomes `progress-bar`, etc.

The above example can be equivalently written as:

```
use GTK::Simple :subs;

my $app = app(title => "Hello GTK!");

$app.set-content(
    v-box(
        my $button1 = button(label => "Hello World"),
        my $button2 = button(label => "Goodbye!")
    )
);

# ...

```

### Further examples

The first four examples were written as mini tutorials to show how the
system works:

* [Hello world](https://github.com/finanalyst/GTK-Simple/blob/master/examples/01-hello-world.raku)
* [Toggles](https://github.com/finanalyst/GTK-Simple/blob/master/examples/02-toggles.raku)
* [A simple grid](https://github.com/finanalyst/GTK-Simple/blob/master/examples/03-grid.raku)
* [Marked Scales](https://github.com/finanalyst/GTK-Simple/blob/master/examples/04-marked-scale.raku)

For more examples, please see the [examples/](https://github.com/finanalyst/GTK-Simple/blob/master/examples) folder.

## Limitations

The full functionality of [GTK 3](http://www.gtk.org/) is not available in
this module.

## Prerequisites

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

### Debian Linux

```
sudo apt-get install libgtk-3-dev

```

### Mac OS X

```
brew update
brew install gtk+3

```

## Windows

The GTK team describes how to do this for Windows at
[Setting up GTK for Window](https://www.gtk.org/docs/installations/windows/)

## Installation and sanity tests

Use the zef package manager

```
$ zef install GTK::Simple

```

## Author

Jonathan Worthington, jnthn on #raku, <https://github.com/jnthn/>

## Contributors

The Raku team

## License

The Artistic License 2.0


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

Raku grammar classes with example address book entities.

This is an example data package used in demos of
["DSL::FiniteStateMachines"](https://raku.land/zef:antononcube/DSL::FiniteStateMachines), [AAp5].

---

## Installation

From Zef ecosystem:

```
zef install DSL::Entity::AddressBook

```

From GitHub:

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

```

---

## Examples

Here are examples of recognizing different types of data acquisition related specifications:

```
use DSL::Entity::AddressBook;
use DSL::Entity::AddressBook::Grammar;

my &ab-parse = { DSL::Entity::AddressBook::Grammar.parse($_, args => (DSL::Entity::AddressBook::resource-access-object(),))};

say &ab-parse('Orlando Bloom');

```

```
# ｢Orlando Bloom｣
#  addressbook-entity-spec-list => ｢Orlando Bloom｣
#   addressbook-entity-spec => ｢Orlando Bloom｣
#    entity-addressbook-person-name => ｢Orlando Bloom｣
#     entity-name => ｢Orlando Bloom｣
#      0 => ｢Orlando Bloom｣
#       entity-name-part => ｢Orlando｣
#       entity-name-part => ｢Bloom｣

```

```
say &ab-parse('Lort of the Rings');

```

```
#ERROR: Possible misspelling of 'lord of the rings' as 'lort of the rings'.
# ｢Lort of the Rings｣
#  addressbook-entity-spec-list => ｢Lort of the Rings｣
#   addressbook-entity-spec => ｢Lort of the Rings｣
#    entity-addressbook-company-name => ｢Lort of the Rings｣
#     entity-name => ｢Lort of the Rings｣
#      0 => ｢Lort of the Rings｣
#       entity-name-part => ｢Lort｣
#       entity-name-part => ｢of｣
#       entity-name-part => ｢the｣
#       entity-name-part => ｢Rings｣

```

```
say &ab-parse('X-Men');

```

```
# ｢X-Men｣
#  addressbook-entity-spec-list => ｢X-Men｣
#   addressbook-entity-spec => ｢X-Men｣
#    entity-addressbook-company-name => ｢X-Men｣
#     entity-name => ｢X-Men｣
#      0 => ｢X-Men｣
#       entity-name-part => ｢X-Men｣

```

---

## References

### Packages

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

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

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

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

[AAp5] Anton Antonov,
[DSL::FiniteStateMachines Raku package](https://github.com/antononcube/Raku-DSL-FiniteStateMachines),
(2022-2023),
[GitHub/antononcube](https://github.com/antononcube).