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

# NAME

Array::Agnostic - be an array without knowing how

# SYNOPSIS

```
use Array::Agnostic;
class MyArray does Array::Agnostic {
    method AT-POS()     { ... }
    method elems()      { ... }
}

my @a is MyArray = 1,2,3;

```

# DESCRIPTION

This module makes an `Array::Agnostic` role available for those classes that wish to implement the `Positional` role as an `Array`. It provides all of the `Array` functionality while only needing to implement 2 methods:

## Required Methods

### method AT-POS

```
method AT-POS($position) { ... }  # simple case

method AT-POS($position) { Proxy.new( FETCH => { ... }, STORE => { ... } }

```

Return the value at the given position in the array. Must return a `Proxy` that will assign to that position if you wish to allow for auto-vivification of elements in your array.

### method elems

```
method elems(--> Int:D) { ... }

```

Return the number of elements in the array (defined as the index of the highest element + 1).

## Optional Methods (provided by role)

You may implement these methods out of performance reasons yourself, but you don't have to as an implementation is provided by this role. They follow the same semantics as the methods on the [Array object](https://docs.perl6.org/type/Array).

In alphabetical order: `append`, `Array`, `ASSIGN-POS`, `end`, `gist`, `grab`, `iterator`, `keys`, `kv`, `list`, `List`, `new`, `pairs`, `perl`, `pop`, `prepend`, `push`, `shape`, `shift`, `Slip`, `STORE`, `Str`, `splice`, `unshift`, `values`

## Optional Internal Methods (provided by role)

These methods may be implemented by the consumer for performance reasons or to provide a given capability.

### method BIND-POS

```
method BIND-POS($position, $value) { ... }

```

Bind the given value to the given position in the array, and return the value. Will throw an exception if called and not implemented.

### method DELETE-POS

```
method DELETE-POS($position) { ... }

```

Mark the element at the given position in the array as absent (make `EXISTS-POS` return `False` for this position). Will throw an exception if called and not implemented.

### method EXISTS-POS

```
method EXISTS-POS($position) { ... }

```

Return `Bool` indicating whether the element at the given position exists (aka, is **not** marked as absent). If not implemented, Will call `AT-POS` and return `True` if the returned value is defined.

### method CLEAR

```
method CLEAR(--> Nil) { ... }

```

Reset the array to have no elements at all. By default implemented by repeatedly calling `DELETE-POS`, which will by all means, be very slow. So it is a good idea to implement this method yourself.

### method move-indexes-up

```
method move-indexes-up($up, $start = 0) { ... }

```

Add the given value to the **indexes** of the elements in the array, optionally starting from a given start index value (by default 0, so all elements of the array will be affected). This functionality is needed if you want to be able to use `shift`, `unshift` and related functions.

### method move-indexes-down

```
method move-indexes-down($down, $start = $down) { ... }

```

Subtract the given value to the **indexes** of the elements in the array, optionally starting from a given start index value (by default the same as the number to subtract, so that all elements of the array will be affected. This functionality is needed if you want to be able to use `shift`, `unshift` and related functions.

## Exported subroutines

### sub is-container

```
my $a = 42;
say is-container($a);  # True
say is-container(42);  # False

```

Returns whether the given argument is a container or not. This can be handy for situations where you want to also support binding, **and** allow for methods such as `shift`, `unshift` and related functions.

# AUTHOR

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

Source can be located at: <https://github.com/lizmat/Array-Agnostic> . 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 2018, 2020, 2021, 2023, 2024 Elizabeth Mattijsen

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


## dist_zef-antononcube-WWW-MermaidInk.md
# WWW::MermaidInk Raku package

The function `mermaid-ink` of the Raku package ["WWW::MermaidInk"](https://github.com/antononcube/Raku-WWW-MermaidInk)
gets images corresponding to Mermaid-js specifications via the web [Mermaid-ink](https://mermaid.ink) interface of [Mermaid-js](https://mermaid.js.org).

For a "full set" of examples see the file
[MermaidInk\_woven.html](https://htmlpreview.github.io/?https://github.com/antononcube/Raku-WWW-MermaidInk/blob/main/docs/MermaidInk_woven.html).

---

## Usage

`use WWW::MermaidInk`
loads the package.

`mermaid-ink($spec)`
retrieves an image defined by the spec `$spec` from Mermaid's Ink Web interface.

`mermaid-ink($spec format => 'md-image')`
returns a string that is a Markdown image specification in Base64 format.

`mermaid-ink($spec format => 'md-url')`
returns a string that is a Markdown image link specification.

`mermaid-ink($spec format => 'svg')`
returns a string that is a Scalable Vector Graphics (SVG) code.

`mermaid-ink($spec format => 'hash')`
returns a Hash object (the result of `HTTP::Tiny.get`.)

`mermaid-ink($spec file => fileName)`
exports the retrieved image into a specified PNG file.

`mermaid-ink($spec file => Whatever)`
exports the retrieved image into the file `$*CMD ~ /out.png`.

### Details & Options

* Mermaid lets you create diagrams and visualizations using text and code.
* Mermaid has different types of diagrams: Flowchart, Sequence Diagram, Class Diagram, State Diagram, Entity Relationship Diagram, User Journey, Gantt, Pie Chart, Requirement Diagram, and others. It is a JavaScript based diagramming and charting tool that renders Markdown-inspired text definitions to create and modify diagrams dynamically.
* `mermaid-ink` uses the Mermaid's functionalities via the Web interface "https://mermaid.ink/img".
* The first argument can be a string (that is, a mermaid-js specification) or a list of pairs.
* The option "directive" can be used to control the layout of Mermaid diagrams if the first argument is a list of pairs.
* `mermaid-ink` produces images or Hash objects (the result of `HTTP::Tiny.get`.)

---

## Examples

### Basic Examples

Generate a flowchart from a Mermaid specification:

```
use WWW::MermaidInk;

'graph TD
   WL --> |ZMQ|Python --> |ZMQ|WL'
 ==> mermaid-ink(format=>'md-url')

```

![](https://mermaid.ink/img/Z3JhcGggVEQgCiAgIFdMIC0tPiB8Wk1RfFB5dGhvbiAtLT4gfFpNUXxXTA==?bgColor=FFFFFF)

Create a Markdown image expression from a class diagram:

```
my $spec = q:to/END/;
classDiagram
    Animal <|-- Duck
    Animal <|-- Fish
    Animal <|-- Zebra
    Animal : +int age
    Animal : +String gender
    Animal: +isMammal()
    Animal: +mate()
    class Duck{
        +String beakColor
        +swim()
        +quack()
    }
    class Fish{
        -int sizeInFeet
        -canEat()
    }
    class Zebra{
        +bool is_wild
        +run()
    }
END

mermaid-ink($spec, format=>'md-url')

```

![](https://mermaid.ink/img/Y2xhc3NEaWFncmFtCiAgICBBbmltYWwgPHwtLSBEdWNrCiAgICBBbmltYWwgPHwtLSBGaXNoCiAgICBBbmltYWwgPHwtLSBaZWJyYQogICAgQW5pbWFsIDogK2ludCBhZ2UKICAgIEFuaW1hbCA6ICtTdHJpbmcgZ2VuZGVyCiAgICBBbmltYWw6ICtpc01hbW1hbCgpCiAgICBBbmltYWw6ICttYXRlKCkKICAgIGNsYXNzIER1Y2t7CiAgICAgICAgK1N0cmluZyBiZWFrQ29sb3IKICAgICAgICArc3dpbSgpCiAgICAgICAgK3F1YWNrKCkKICAgIH0KICAgIGNsYXNzIEZpc2h7CiAgICAgICAgLWludCBzaXplSW5GZWV0CiAgICAgICAgLWNhbkVhdCgpCiAgICB9CiAgICBjbGFzcyBaZWJyYXsKICAgICAgICArYm9vbCBpc193aWxkCiAgICAgICAgK3J1bigpCiAgICB9Cg==?bgColor=FFFFFF)

### Scope

The first argument can be a list of pairs -- the corresponding Mermaid-js graph is produced.
Here are the edges of directed graph:

```
my @edges = ['1' => '3', '3' => '1', '1' => '4', '2' => '3', '2' => '4', '3' => '4'];

```

[1 => 3 3 => 1 1 => 4 2 => 3 2 => 4 3 => 4]

Here is the corresponding mermaid-js image:

```
mermaid-ink(@edges, format=>'md-url')

```

![](https://mermaid.ink/img/Z3JhcGgKMSAtLT4gMwozIC0tPiAxCjEgLS0+IDQKMiAtLT4gMwoyIC0tPiA0CjMgLS0+IDQ=?bgColor=FFFFFF)

Scalable Vector Graphics (SVG) code can be generated with `format => 'svg'`:

```
mermaid-ink(@edges, format=>'svg')

```

```
# <svg id="mermaid-svg" width="100%" xmlns="http://www.w3.org/2000/svg" style="max-width: 124.205px; background-color: rgb(255, 255, 255);" viewBox="-9.423566102981567 -8 124.20481872558594 218" role="graphics-document document" aria-roledescription="flowchart-v2" xmlns:xlink="http://www.w3.org/1999/xlink"><style>#mermaid-svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg .error-icon{fill:#552222;}#mermaid-svg .error-text{fill:#552222;stroke:#552222;}#mermaid-svg .edge-thickness-normal{stroke-width:2px;}#mermaid-svg .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg .marker{fill:#333333;stroke:#333333;}#mermaid-svg .marker.cross{stroke:#333333;}#mermaid-svg svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg .cluster-label text{fill:#333;}#mermaid-svg .cluster-label span,#mermaid-svg p{color:#333;}#mermaid-svg .label text,#mermaid-svg span,#mermaid-svg p{fill:#333;color:#333;}#mermaid-svg .node rect,#mermaid-svg .node circle,#mermaid-svg .node ellipse,#mermaid-svg .node polygon,#mermaid-svg .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg .flowchart-label text{text-anchor:middle;}#mermaid-svg .node .label{text-align:center;}#mermaid-svg .node.clickable{cursor:pointer;}#mermaid-svg .arrowheadPath{fill:#333333;}#mermaid-svg .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg .edgeLabel{background-color:#e8e8e8;text-align:center;}#mermaid-svg .edgeLabel rect{opacity:0.5;background-color:#e8e8e8;fill:#e8e8e8;}#mermaid-svg .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg .cluster text{fill:#333;}#mermaid-svg .cluster span,#mermaid-svg p{color:#333;}#mermaid-svg div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}</style><g><marker id="mermaid-svg_flowchart-pointEnd" class="marker flowchart" viewBox="0 0 10 10" refX="6" refY="5" markerUnits="userSpaceOnUse" markerWidth="12" markerHeight="12" orient="auto"><path d="M 0 0 L 10 5 L 0 10 z" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"></path></marker><marker id="mermaid-svg_flowchart-pointStart" class="marker flowchart" viewBox="0 0 10 10" refX="4.5" refY="5" markerUnits="userSpaceOnUse" markerWidth="12" markerHeight="12" orient="auto"><path d="M 0 5 L 10 10 L 10 0 z" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"></path></marker><marker id="mermaid-svg_flowchart-circleEnd" class="marker flowchart" viewBox="0 0 10 10" refX="11" refY="5" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><circle cx="5" cy="5" r="5" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"></circle></marker><marker id="mermaid-svg_flowchart-circleStart" class="marker flowchart" viewBox="0 0 10 10" refX="-1" refY="5" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><circle cx="5" cy="5" r="5" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"></circle></marker><marker id="mermaid-svg_flowchart-crossEnd" class="marker cross flowchart" viewBox="0 0 11 11" refX="12" refY="5.2" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><path d="M 1,1 l 9,9 M 10,1 l -9,9" class="arrowMarkerPath" style="stroke-width: 2; stroke-dasharray: 1, 0;"></path></marker><marker id="mermaid-svg_flowchart-crossStart" class="marker cross flowchart" viewBox="0 0 11 11" refX="-1" refY="5.2" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><path d="M 1,1 l 9,9 M 10,1 l -9,9" class="arrowMarkerPath" style="stroke-width: 2; stroke-dasharray: 1, 0;"></path></marker><g class="root"><g class="clusters"></g><g class="edgePaths"><path d="M3.6,34L1.616,38.167C-0.368,42.333,-4.336,50.667,2.099,60.135C8.534,69.604,25.372,80.207,33.791,85.509L42.21,90.811" id="L-1-3-0" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-1 LE-3" style="fill:none;" marker-end="url(#mermaid-svg_flowchart-pointEnd)"></path><path d="M52.988,84L51.664,79.833C50.34,75.667,47.691,67.333,43.308,59.313C38.924,51.294,32.805,43.587,29.746,39.734L26.686,35.881" id="L-3-1-0" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-3 LE-1" style="fill:none;" marker-end="url(#mermaid-svg_flowchart-pointEnd)"></path><path d="M11.695,34L11.695,38.167C11.695,42.333,11.695,50.667,11.695,61.833C11.695,73,11.695,87,11.695,101C11.695,115,11.695,129,14.755,139.853C17.814,150.706,23.933,158.413,26.993,162.266L30.052,166.119" id="L-1-4-0" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-1 LE-4" style="fill:none;" marker-end="url(#mermaid-svg_flowchart-pointEnd)"></path><path d="M85.636,34L83.319,38.167C81.003,42.333,76.371,50.667,72.998,58.158C69.625,65.65,67.512,72.299,66.455,75.624L65.398,78.949" id="L-2-3-0" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-2 LE-3" style="fill:none;" marker-end="url(#mermaid-svg_flowchart-pointEnd)"></path><path d="M99.134,34L100.126,38.167C101.118,42.333,103.102,50.667,104.094,61.833C105.086,73,105.086,87,105.086,101C105.086,115,105.086,129,97.752,141.13C90.418,153.26,75.749,163.521,68.415,168.651L61.081,173.781" id="L-2-4-0" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-2 LE-4" style="fill:none;" marker-end="url(#mermaid-svg_flowchart-pointEnd)"></path><path d="M58.391,118L58.391,122.167C58.391,126.333,58.391,134.667,57.334,142.158C56.277,149.65,54.164,156.299,53.107,159.624L52.051,162.949" id="L-3-4-0" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-3 LE-4" style="fill:none;" marker-end="url(#mermaid-svg_flowchart-pointEnd)"></path></g><g class="edgeLabels"><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="edgeLabel"></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="edgeLabel"></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="edgeLabel"></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="edgeLabel"></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="edgeLabel"></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="edgeLabel"></span></div></foreignObject></g></g></g><g class="nodes"><g class="node default default flowchart-label" id="flowchart-1-0" transform="translate(11.6953125, 17)"><rect class="basic label-container" style="" rx="0" ry="0" x="-11.6953125" y="-17" width="23.390625" height="34"></rect><g class="label" style="" transform="translate(-4.1953125, -9.5)"><rect></rect><foreignObject width="8.390625" height="19"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="nodeLabel">1</span></div></foreignObject></g></g><g class="node default default flowchart-label" id="flowchart-2-6" transform="translate(95.0859375, 17)"><rect class="basic label-container" style="" rx="0" ry="0" x="-11.6953125" y="-17" width="23.390625" height="34"></rect><g class="label" style="" transform="translate(-4.1953125, -9.5)"><rect></rect><foreignObject width="8.390625" height="19"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="nodeLabel">2</span></div></foreignObject></g></g><g class="node default default flowchart-label" id="flowchart-3-1" transform="translate(58.390625, 101)"><rect class="basic label-container" style="" rx="0" ry="0" x="-11.6953125" y="-17" width="23.390625" height="34"></rect><g class="label" style="" transform="translate(-4.1953125, -9.5)"><rect></rect><foreignObject width="8.390625" height="19"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="nodeLabel">3</span></div></foreignObject></g></g><g class="node default default flowchart-label" id="flowchart-4-5" transform="translate(45.04296875, 185)"><rect class="basic label-container" style="" rx="0" ry="0" x="-11.6953125" y="-17" width="23.390625" height="34"></rect><g class="label" style="" transform="translate(-4.1953125, -9.5)"><rect></rect><foreignObject width="8.390625" height="19"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="nodeLabel">4</span></div></foreignObject></g></g></g></g></g><style>@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css");</style></svg>

```

### Options

When `format => 'svg'` and `subdomain => Whatever`, then `subdomain` is automatically determined to be "svg".
The argument `subdomain` can take the values "base64", "hash", "md-image", "md-url", "svg", `Whatever`.

Background color can be specified with the optional argument `background`.

Here is an example of using "md-url" as a format and background "Cornsilk":

```
'graph LR
   CompSci[Computational Science] --> Physics
   CompSci --> Math[Mathematics]
   Physics --> Philosophy
   Math --> Philosophy'
 ==> mermaid-ink(format=>'md-url', background=>'Cornsilk')

```

![](https://mermaid.ink/img/Z3JhcGggTFIKICAgQ29tcFNjaVtDb21wdXRhdGlvbmFsIFNjaWVuY2VdIC0tPiBQaHlzaWNzCiAgIENvbXBTY2kgLS0+IE1hdGhbTWF0aGVtYXRpY3NdCiAgIFBoeXNpY3MgLS0+IFBoaWxvc29waHkgCiAgIE1hdGggLS0+IFBoaWxvc29waHk=?bgColor=!Cornsilk)

---

## Command Line Interface (CLI)

The package provides the CLI script `mermaid-ink`. Here is its help message:

```
mermaid-ink --help

```

```
# Usage:
#   mermaid-ink <spec> [-o|--file=<Str>] [--format=<Str>] -- Diagram image for Mermaid-JS spec (via mermaid.ink).
#   mermaid-ink [<words> ...] [-o|--file=<Str>] [--format=<Str>] -- Command given as a sequence of words.
#
#     <spec>             Mermaid-JS spec.
#     -o|--file=<Str>    File to export the image to. [default: '']
#     --format=<Str>     Format of the result; one of "asis", "base64", "md-image", or "none". [default: 'md-image']

```

---

## Flowchart

This flowchart summarizes the execution path of obtaining Mermaid images in a Markdown document:

```
graph TD
    UI[/User input/]
    MS{{Mermaid-ink server}}
    Raku{{Raku}}
    MDnb>Markdown document]
    MDIC[[Input cell]]
    MDOC[[Output cell]]
    MI[mermaid-ink]
    TCP[[Text::CodeProcessing]]
    UI --> MDIC -.- MDnb
    MDIC --> MI -.- TCP
    MI --> |spec|MS
    MS --> |image|MI
    MI --> MDOC -.- MDnb
    MDnb -.- TCP -.- Raku

```

---

## References

### Articles

[AA1] Anton Antonov,
["Interactive Mermaid diagrams generation via Markdown evaluation"](https://rakuforprediction.wordpress.com/2022/11/22/interactive-mermaid-diagrams-generation-via-markdown-evaluation/),
(2022),
[RakuForPrediction at WordPress](https://rakuforprediction.wordpress.com).

### Functions and packages

[AAf1] Anton Antonov,
[MermaidInk Mathematica resource function](https://www.wolframcloud.com/obj/antononcube/DeployedResources/Function/MermaidInk/),
(2022-2023),
[Wolfram Function Repository](https://resources.wolframcloud.com/FunctionRepository/).

### Mermaid resources

* [GitHub - mermaid-js/mermaid: Generation of diagram and flowchart from text in a similar manner as markdown](https://github.com/mermaid-js/mermaid)
* [mermaid - Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.](https://mermaid-js.github.io/mermaid)
* [GitHub - mermaid-js/mermaid-cli: Command line tool for the Mermaid library](https://github.com/mermaid-js/mermaid-cli)
* [Online FlowChart & Diagrams Editor - Mermaid Live Editor](https://mermaid.live/)


## dist_zef-p6steve-Physics-Measure.md
![Test Status](https://github.com/p6steve/raku-Physics-Measure/actions/workflows/prove6.yml/badge.svg)

# raku-Physics-Measure

Provides Measure objects that have value, units and error and can be used in many common physics calculations. Uses [Physics::Unit](https://github.com/p6steve/raku-Physics-Unit) and [Physics::Error](https://github.com/p6steve/raku-Physics-Error).

# Instructions

`zef --verbose install Physics::Measure`

and, conversely, `zef uninstall Physics::Measure`

# Synopsis

```
use lib '../lib';
use Physics::Measure :ALL;

# Basic mechanics example (SI units)...

# Define a distance and a time
my \d = 42m;                say ~d;     #42 m      (Length)
my \t = 10s;                say ~t;     #10 s      (Time)

# Calculate speed and acceleration
my \u = d / t;              say ~u;     #4.2 m/s   (Speed)
my \a = u / t;              say ~a;     #0.42 m/s^2 (Acceleration)

# Define mass and calculate force
my \m = 25kg;               say ~m;     #25 kg     (Mass)
my \f = m * a;              say ~f;     #10.5 N    (Force)

# Calculate final speed and distance travelled
my \v = u + a*t;            say ~v;     #8.4 m/s   (Speed)
my \s = u*t + (1/2) * a * t*t;  say ~s; #63 m      (Length)

# Calculate potential energy
my \pe = f * s;             say ~pe;    #661.5 J   (Energy)

# Calculate kinetic energy
my \ke1 = (1/2) * m * u*u;
my \ke2 = (1/2) * m * v*v;

# Calculate the delta in kinetic energy
my \Δke = ke2 - ke1;

# Compare potential vs. delta kinetic energy
(pe cmp Δke).say;                      #Same

```

This example shows some key features of Physics::Measure...

* support for SI prefixes, base and derived units (cm, kg, ml and so on)
* imported as raku postfix operators for convenience and clarity
* custom math operators `(+-*/)` for easy inclusion in calculations
* inference of type class (Length, Time, Mass, etc.) from units
* derivation of type class of results (Speed, Acceleration, etc.)

# Use Cases

The Physics::Measure and Physics::Unit modules were designed with the following use cases in mind:

* convenient use for practical science - lab calculations and interactive presentation of data sets
* a framework for educators and students to interactively explore basic physics via a modern OO language
* an everyday unit conversion and calculation tool (not much point if it can't convert miles to km and so on)

Some other use cases - use for physical chemistry calculations (eg. environmental) and for historic data ingestion - have also been seen on the horizon and the author would be happy to work with you to help adapt to meet a wider set of needs.

# Design Model

To address the Use Cases, the following consistent functional parts have been created:

* a raku Class and Object model to represent Units and Measurements
* methods for Measure math operations, output, comparison, conversion, normalisation and rebasing
* a Unit Grammar to parse unit expressions and cope with textual variants such as ‘miles per hour’ or ‘mph’, or ‘m/s’, ‘ms^-1’, ‘m.s-1’
* an extensible library of about 800 built in unit types covering SI base, derived, US and imperial
* a set of "API" options to meet a variety of consumption needs

Together Physics::Measure and Physics::Unit follow this high level class design model:

```
class Unit {
   has Str $.defn;
   #...
}
class Measure {
   has Real $.value;
   has Unit $.units;
   has Error $.error;
   #...
}
class Length is Measure {}
class Time   is Measure {}
class Speed  is Measure {}
#and so on

```

Type classes represent physical measurement such as (Length), (Time), (Speed), etc. They are child classes of the (Measure) parent class.

You can do math operations on (Measure) objects - (Length) can add/subtract to (Length), (Time) can add/subtract to (Time), and so on. A mismatch like adding a (Length) to a (Time) gives a raku Type error *cannot convert in to different type Length*. You can, however, divide e.g. (Length) by (Time) and then get a (Speed) type back. (Length) \*\* 2 => (Area). (Length) \*\* 3 => (Volume). And so on. There are 36 pre-defined types provided. Methods are provided to create custom units and types.

Therefore, in the normal course, please make your objects as instances of the Child type classes.

# Three Consumer Options

## Option 1: Postfix Operator Syntax (SI Units)

As seen above, if you just want SI prefixes, base and derived units (cm, kg, ml and so on), the :ALL export label provides them as raku postfix:<> custom operators. This option is intended for scientist / coders who want fast and concise access to a modern Unit library. Here is another example, basic wave mechanics, bringing in the [Physics::Constants](https://github.com/p6steve/raku-Physics-Constants) module:

```
use Physics::Constants;  #<== must use before Physics::Measure
use Physics::Measure :ALL;

$Physics::Measure::round-to = 0.01;

my \λ = 2.5nm;
my \ν = c / λ;
my \Ep = ℎ * ν;

say "Wavelength of photon (λ) is " ~λ;              #2.5 nm
say "Frequency of photon (ν) is " ~ν.norm;          #119.92 petahertz
say "Energy of photon (Ep) is " ~Ep.norm;           #79.46 attojoule

```

The following SI units are provided in all Prefix-Unit combinations:

| SI Base Unit (7) | SI Derived Unit (20) | SI Prefix (20) |
| --- | --- | --- |
| 'm', 'metre', | 'Hz', 'hertz', | 'da', 'deka', |
| 'g', 'gram', | 'N', 'newton', | 'h', 'hecto', |
| 's', 'second', | 'Pa', 'pascal', | 'k', 'kilo', |
| 'A', 'amp', | 'J', 'joule', | 'M', 'mega', |
| 'K', 'kelvin', | 'W', 'watt', | 'G', 'giga', |
| 'mol', 'mol', | 'C', 'coulomb', | 'T', 'tera', |
| 'cd', 'candela', | 'V', 'volt', | 'P', 'peta', |
|  | 'F', 'farad', | 'E', 'exa', |
|  | 'Ω', 'ohm', | 'Z', 'zetta', |
|  | 'S', 'siemens', | 'Y', 'yotta', |
|  | 'Wb', 'weber', | 'd', 'deci', |
|  | 'T', 'tesla', | 'c', 'centi', |
|  | 'H', 'henry', | 'm', 'milli', |
|  | 'lm', 'lumen', | 'μ', 'micro', |
|  | 'lx', 'lux', | 'n', 'nano', |
|  | 'Bq', 'becquerel', | 'p', 'pico', |
|  | 'Gy', 'gray', | 'f', 'femto', |
|  | 'Sv', 'sievert', | 'a', 'atto', |
|  | 'kat', 'katal', | 'z', 'zepto', |
|  | 'l', 'litre', | 'y', 'yocto', |

#litre included due to common use of ml, dl, etc.

## Option 2: Object Constructor Syntax

In addition to the SI units listed above, Physics::Measure (and Physics::Unit) offers a comprehensive library of non-metric units. US units and Imperial units include feet, miles, knots, hours, chains, tons and over 200 more. The non-metric units are not exposed as postfix operators.

```
my Length $d = Length.new(value => 42, units => 'miles');   say ~$d;         #42 mile
my Time   $t = Time.new(  value =>  7, units => 'hours');   say ~$t;         #7 hr
my $s = $d / $t;                                  say ~$s.in('mph');         #6 mph

```

A flexible unit expression parser is included to cope with textual variants such as ‘miles per hour’ or ‘mph’; or ‘m/s’, ‘ms^-1’, ‘m.s-1’ (the SI derived unit representation) or ‘m⋅s⁻¹’ (the SI recommended string representation, with superscript powers). The unit expression parser decodes a valid unit string into its roots, extracting unit dimensions and inferring the appropriate type.

```
#Colloquial terms or unicode superscripts can be used for powers in unit declarations
    #square, sq, squared, cubic, cubed
    #x¹ x² x³ x⁴ and x⁻¹ x⁻² x⁻³ x⁻⁴

```

Of course, the standard raku object constructor syntax may be used for SI units too:

```
my Length $l = Length.new(value => 42, units => 'μm'); say ~$l; #42 micrometre

```

This syntax option is the most structured and raku native. For example, it helps educators to use units and basic physics exercises as a way to introduce students to formal raku Object Orientation principles.

## Option 3: Libra Shorthand Syntax

In many cases, coders will want the flexibility of the unit expression parser and the wider range of non-metric units but they also want a concise notation. In this case, the unicode libra emoji ♎ is provided as raku prefix for object construction:

```
#The libra ♎ is shorthand to construct objects...
    my $a = ♎ '4.3 m';                  say "$a";		#4.3 m
    my $b = ♎ '5e1 m';                  say "$b";		#50 m
    my $c = $a;                          say "$c";		#4.3 m
    my Length $l = ♎ 42;                say "$l";		#42 m (default to base unit of Length)
#...there is an ASCII variant of <♎> namely <libra>

```

*Use the emoji editor provided on your system (or just cut and paste)*

```
#About 230 built in units are included, for example...
    my $v2 = ♎ '7 yards^3';          #7 yard^3         (Volume)
    my $v3 = $v2.in( 'm3' );        #5.352 m^3        (Volume)
    my $dsdt = $s / $t;             #0.000106438 m/s^2 (Acceleration)
    my $sm = ♎ '70 mph';             #70 mph           (Speed)
    my $fo = ♎ '27 kg m / s2';       #27 N             (Force)
    my $en = ♎ '26 kg m^2 / s^2';    #26 J             (Energy)
    my $po = ♎ '25 kg m^2 / s^3';    #25 W             (Power)

```

# Special Measure Types

## Angles

```
#Angles use degrees/minutes/seconds or decimal radians
    my $θ1 = ♎ <45°30′30″>;      #45°30′30″ (using <> to deconfuse quotation marks)
    my $θ2 = ♎ '2.141 radians';  #'2.141 radian'
#NB. The unit name 'rad' is reserved for the unit of radioactive Dose

# Trigonometric functions sin, cos and tan (and arc-x) handle Angles
    my $sine = sin( $θ1 );      #0.7133523847299412
    my $arcsin = asin( $sine, units => '°' ); #45°30′30″
#NB. Provide the units => '°' tag to tell asin you want degrees back

```

## Time

```
#The Measure of Time has a raku Duration - i.e. the difference between two DateTime Instants:
    my $i1 = DateTime.now;
    my $i2 = DateTime.new( '2020-08-10T14:15:27.26Z' );
    my $i3 = DateTime.new( '2020-08-10T14:15:37.26Z' );
    my Duration $dur = $i3-$i2;

#Here's how to us the libra assignment operator ♎ for Time...
    my Time $t1 = ♎ '5e1 s';     	#50 s
    my Time $t2 = ♎ $dur;        	#10 s
    my $t3 = $t1 + $t2;         	#60 s
    my Time $t4 = ♎ '2 hours';   	#2 hr
    $dur = $t4.Duration;         #7200

```

# Unit Conversion

```
#Unit Conversion uses the .in() method - specify the new units as a String
    my Length $df = ♎ '12.0 feet';         #12 ft
    my $dm = $df.in( 'm' );               #3.658 m
       $dm = $df.in: <m>;                 #alternate form
    my Temperature $deg-c = ♎ '39 °C';
    my $deg-k = $deg-c.in( 'K' );         #312.15 K
    my $deg-cr = $deg-k.in( '°C' );       #39 °C

#Use arithmetic to get high order or inverse Unit types such as Area, Volume, Frequency, etc.
    my Area	      $x = $a * $a;           #18.49 m^2
    my Speed      $s = $a / $t2;          #0.43 m/s
    my Frequency  $f = 1  / $t2;          #0.1 Hz

#Use powers & roots with Int or Rat (<1/2>, <1/3> or <1/4>)
    my Volume     $v = $a ** 3;           #79.507 m^3
    my Length	   $d = $v ** <1/3>;       #0.43 m

```

The ① symbol is used to denote Dimensionless units.

# Rounding & Normalisation

```
#Set rounding precision (or reset with Nil) - does not reduce internal precision
    $Physics::Measure::round-to = 0.01;
#Normalize SI Units to the best SI prefix (from example above)
    say "Frequency of photon (ν) is " ~ν.norm;    #119.92 petahertz
#Reset to SI base type with the .rebase() method
    my $v4 = $v2.rebase;                  #5.35 m^3

```

# Comparison Methods

```
#Measures can be compared with $a cmp $b
    my $af = $a.in: 'feet';             #4.3 m => 14.108 feet
    say $af cmp $a;                     #Same
#Measures can be tested for equality with Numeric ==,!=
    say $af == $a;                      #True
    say $af != $a;                      #False
#Use string equality eq,ne to distinguish different units with same type
    say $af eq $a;                      #False
    say $af ne $a;                      #True

```

# Output Methods

To see what you have got, then go:

```
my $po = 25W;
say ~$po; say "$po"; say $po.Str;       #25 W  (defaults to derived unit)
say +$po; say $po.value; say $po.Real;  #25
say $po.WHAT;                           #(Power)
say $po.canonical;                      #25 m2.s-3.kg   (SI base units)
say $po.pretty;                         #25 m²⋅s⁻³⋅kg   (SI recommended style)
                                              ^...^......unicode Dot Operator U+22C5

```

# Dealing with Ambiguous Types

In a small number of case, the same units are used by different unit Types. Type hints
steer type inference:

```
our %type-hints = %(
    Area        => <Area FuelConsumption>,
    Energy      => <Energy Torque>,
    Momentum    => <Momentum Impulse>,
    Frequency   => <Frequency Radioactivity>,
);

```

To adjust this, you can delete the built in key and replace it with your own:

```
my %th := %Physics::Unit::type-hints;

#default type-hints
my $en1 = ♎'60 J';     #'$en1 ~~ Energy';
my $tq1 = ♎'5 Nm';     #'$tq1 ~~ Torque';

#altered type-hints
%th<Energy>:delete;
%th<Torque> = <Energy Torque>;

my $fo3 = ♎'7.2 N';
my $le2 = ♎'2.2 m';
my $tq2 = $fo3 * $le2;  #'$tq2 ~~ Torque';

```

# Custom Measures

To make a custom Measure, you can use this incantation:

```
GetMeaUnit('nmile').NewType('Reach');

class Reach is Measure {
    has $.units where *.name eq <nm nmile nmiles>.any;

    #| override .in to perform identity 1' (Latitude) == 1 nmile
    method in( Str $s where * eq <Latitude> ) {
        my $nv = $.value / 60;
        Latitude.new( value => $nv, compass => <N> )
    }
}

```

# Summary

The family of Physics::Measure, Physics::Unit and Physics::Constants raku modules is a consistent and extensible toolkit intended for science and education. It provides a comprehensive library of both metric (SI) and non-metric units, it is built on a Type Object foundation, it has a unit expression Grammar and implements math, conversion and comparison methods.

Any feedback is welcome to p6steve / via the github Issues above.


## dist_zef-thundergnat-App-pixel-pick.md
# NAME pixel-pick

Get the color of any screen pixel in an X11 environment.

Simple command-line app to allow you to get the RGB color of ***any*** screen pixel in an X11 environment, even those controlled by another application.

### Install

```
zef install App::pixel-pick

```

Needs to have the `import` utility available. Installed part of the `MagickWand` package. Most Linuxes have it already, if not, install `libmagickwand`. May want to install `libmagickwand-dev` as well, though it isn't strictly necessary for this app.

```
sudo apt-get install libmagickwand-dev

```

For Debian based distributions.

Uses the `X11::libxdo` module for mouse interaction so will only run in an X11 environment.

## Use

### Interactive:

```
pixel-pick <--distance=Int> <--list=COLOR,LISTS>

```

If invoked with no positional parameters, runs in interactive mode. Will get the color of the pixel under the mouse pointer and show the RGB values in both decimal and hexadecimal formats and will display a small block colored to that value. Will also display colored blocks of "Named colors", along with their RGB values, that are "near" the selected color.

Will accept an Integer "distance" parameter at the command line to fine tune the cutoff for what is "near". (Defaults to 20. More than about 80 or so is not recommended. You'll get unusefully large numbers of matches.) Will always return at least one "nearest" color, no matter what the threshold is. The colors may not be exact, they are just the nearest found in the list.

Uses the XKCD CSS3 and X11 color name lists from the Color::Names module by default as its list of known colors.

See [XKCD color blocks](https://www.w3schools.com/colors/colors_xkcd.asp), [W3 CSS 3 standard web colors](https://www.w3schools.com/cssref/css_colors.asp), and [X11 color blocks](https://www.w3schools.com/colors/colors_x11.asp).

If different color lists are desired, pass in a comma joined list of names. Any of the lists supported by `Color::Names:api<2>` may be used.

```
X11 XKCD CSS3 X11-Grey NCS NBS Crayola Resene RAL-CL RAL-DSP FS595B FS595C

```

as of this writing. The (case-sensitive) names must be in one contiuous string joined by commas. E.G.

```
pixel-pick --list=Crayola,XKCD

```

Updates moderately slowly as the mouse is moved. There is some delay just to slow down the busy loop of checking to see if the mouse has moved. Will not attempt to update if the mouse has not moved. Uses the `X11::xdo` module to capture mouse motion so will only work in an X11 environment.

Note that screen sub-pixel dithering may lead to some unexpected values being returned, especially around small text. The utility returns what the pixel color ***is***, not what it is perceived to be.

When in interactive mode, you need to send an abort signal to exit the utility. Control-C will reset your terminal to its previous settings and do a full clean-up. If you want to keep the color block and values around, do Control-Z instead. That will also reset the terminal, but will not clean up as much, effectively leaving the last values displayed.

### Non-interactive: (Get the color of the pixel at 100, 200)

```
pixel-pick 100 200 (--distance=Int)

```

If invoked with X, Y coordinates, (--distance parameter optional) runs non-interactive. Gets the pixel color at that coordinate and exits immediately, doing the partial cleanup as you would get from Control-Z.

### Non-interactive, quiet: (Get the RGB values of the pixel at 100, 200)

```
pixel-pick 100 200 q

```

Add a truthy value as a "quiet" parameter to not return the standard color parameters and block. Only returns the RGB values in base 10 separated by colons. EG. `RRR:GGG:BBB`

If you would prefer to receive hex values, use an 'h' as the quiet parameter. Returns the RGB values in hexadecimal, separated by colons; `RR:GG:BB`.

```
pixel-pick 100 200 h

```

# Author

2019 thundergnat (Steve Schulze)

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

# License

Licensed under The Artistic 2.0; see LICENSE.


## privatemethodcontainer.md
role Metamodel::PrivateMethodContainer

Metaobject that supports private methods

```raku
role Metamodel::PrivateMethodContainer { ... }
```

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

In Raku, classes, roles and grammars can have private methods, that is, methods that are only callable from within it, and are not inherited by types derived by inheritance.

```raku
class A {
    # the ! declares a private method
    method !double($x) {
        say 2 * $x;
    }
    method call-double($y) {
        # call with ! instead of .
        self!double($y);
    }
}
```

For the purposes of dispatching and scoping, private methods are closer to subroutines than to methods. However they share access to `self` and attributes with methods.

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

## [method add\_private\_method](#role_Metamodel::PrivateMethodContainer "go to top of document")[§](#method_add_private_method "direct link")

```raku
method add_private_method($obj, $name, $code)

```

Adds a private method `$code` with name `$name`.

## [method private\_method\_table](#role_Metamodel::PrivateMethodContainer "go to top of document")[§](#method_private_method_table "direct link")

```raku
method private_method_table($obj)

```

Returns a hash of `name => &method_object`

## [method private\_methods](#role_Metamodel::PrivateMethodContainer "go to top of document")[§](#method_private_methods "direct link")

```raku
method private_methods($obj)

```

Returns a list of private method names.

## [method private\_method\_names](#role_Metamodel::PrivateMethodContainer "go to top of document")[§](#method_private_method_names "direct link")

```raku
method private_method_names($obj)

```

Alias to `private_methods`.

## [method find\_private\_method](#role_Metamodel::PrivateMethodContainer "go to top of document")[§](#method_find_private_method "direct link")

```raku
method find_private_method($obj, $name)

```

Locates a private method. Otherwise, returns [`Mu`](/type/Mu) if it doesn't exist.


## dist_zef-jonathanstowe-FastCGI-NativeCall.md
# FastCGI::NativeCall

This is an implementation of FastCGI for Raku using NativeCall

![Build Status](https://github.com/jonathanstowe/raku-fastcgi-nativecall/workflows/CI/badge.svg)

## Synopsis

```
use FastCGI::NativeCall;

my $fcgi = FastCGI::NativeCall.new(path => "/tmp/fastcgi.sock", backlog => 32 );

my $count = 0;

while $fcgi.accept() {
	say $fcgi.env;
    $fcgi.header(Content-Type => "text/html");
    $fcgi.Print("{ ++$count }");
}

```

There is an example [nginx](http://nginx.org/) configuration in the <examples> directory.

If you are using Apache httpd with [mod\_fcgid](https://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html) your script will be executed by the server with its STDIN (file descriptor 0) opened as the listening socket so you don't need to create your own socket and the script above becomes something like:

```
use FastCGI::NativeCall;

my $fcgi = FastCGI::NativeCall.new(socket => 0 );

my $count = 0;

while $fcgi.accept() {
	say $fcgi.env;
    $fcgi.header(Content-Type => "text/html");
    $fcgi.Print("{ ++$count }");
}

```

There is a snippet of Apache configuration in the [examples](examples/apache.conf) directory. You will almost certainly want to tweak that to your own requirements.

## Description

[FastCGI](https://fastcgi-archives.github.io/) is a protocol that allows an HTTP server to communicate with a persistent application over a socket, thus removing the process startup overhead of, say, traditional CGI applications. It is supported as standard (or through supporting modules,) by most common HTTP server software (such as Apache, nginx, lighthttpd and so forth.)

This module provides a simple mechanism to create FastCGI server applications in Raku.

The FastCGI servers are single threaded, but with good support from the front end server and tuning of the configuration it can be quite efficient.

## Installation

In order to use this properly you will need some front end server that supports FastCGI using unix domain sockets.

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

```
zef install FastCGI::NativeCall

# Or from a local clone of the distribution

zef install .

```

## Support

I'm probably not the right person to ask about configuring various HTTP servers for FastCGI. Though I'd be interested in sample configurations if anyone wants to provide any.

If you are running under SELinux with Apache you may find that it won't run your script and you will need to do something like:

```
chcon -R -t httpd_sys_script_exec_t /var/www/fcgi

```

obviously adjusting this to your own circumstances.

Also the tests are a bit rubbish, I haven't worked out how to mock an HTTP server that does FastCGI yet.

If you have any suggestions/bugs etc please report them at <https://github.com/jonathanstowe/raku-fastcgi-nativecall/issues>

## Licence and Copyright

This is free software please see the <LICENSE> file in the distribution.

© carbin 2015
© Jonathan Stowe 2016 - 2021

The FastCGI C application library is distributed under its own license.
See "ext/LICENSE.TERMS" for the license.


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

# App::MoarVM::Debug

The interactive MoarVM debugger installs a script called `raku-remote-debug` that allows a developer to start a Raku program in debugger mode, while in another window allows the developer to step through the program and perform various types of introspection.

## Starting in debugger mode

```
$ raku-remote-debug your-program.raku arg1 arg2

```

Starting a program in debugger mode is as simple as replacing `raku` by `raku-remote-debug` on the command line. That's it.

When it is started this way, it will show a text on STDERR such as:

```
Running with debugging enabled at localhost port 27434

```

Your program will not actually execute until you have entered the `resume` command in the debugger.

## Starting the debugger

```
$ raku-remote-debug

```

To start the debugger, call `raku-remote-debug` **without** any arguments. It will show you a text such as:

```
Welcome to the MoarVM Remote Debugger

Connecting to MoarVM remote on localhost port 27434
success!
>

```

You would typically then set breakpoints or do some introspection. And then start the program by typing "resume" to lift the suspension of all threads in the program.

Type "help" in the debugger's CLI to see what commands are available to you.

## Limitations

The debugger uses a single port to communicate between your program and the debugger. By default this is port `27434`.

This means that on any given computer, only one program can be debugged this way, and only one debugger can run at the same time.

Should you need to have more debuggers running at the same time, or for some reason you need to use another port, you can set the environment variable `MVM_DEBUG_PORT` to the port you'd like to use.

To start your program:

```
$ MVM_DEBUG_PORT=4242 raku-remote-debug your-program.raku arg1 arg2

```

To start the debugger:

```
$ MVM_DEBUG_PORT=4242 raku-remote-debug

```

## Some hints

* (Optional) Write `assume thread 1` to assume tracking of first (main) thread
* Set a breakpoint

  > breakpoint "my-script.raku" 1234 1 1

The string is the filename and `1234` is the line number (`1 1` is the secret ingredient). Ensure the line number doesn't point to an empty line.

* Type `resume` to run your script.
* The breakpoint will trigger, you can type `all lexicals` to view all lexicals. The numbers shown next to them in bold are "handle" numbers.
* Find the object you want to dump and type `metadata 1234` (`1234` is the handle number).

If the features includes `attributes`, you can enter `attributes 1234` for this object to get information about the object's attributes.

If the features includes `positional`, you can enter `positionals 1234` to get information about the positional elements of the object.

If the features includes `associative`, you can enter `associatives 1234` to get information about the associative elements (keys and values) of the object.

The `metadata` command is only needed if you don't know which of these commands is useful for any given type.

* Type `help` to see all of the available commands.

## Known Issues

The only stepping mode currently available is Step Into.

Backtraces will show incorrect line numbers.

# AUTHOR

* Timo Paulssen

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

# COPYRIGHT AND LICENSE

Copyright 2017 - 2020 Edument AB

Copyright 2024 The Raku Community

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


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

# NAME

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

# SYNOPSIS

```
use P5tie; # exports tie(), tied() and untie()

tie my $s, Tie::AsScalar;
tie my @a, Tie::AsArray;
tie my %h, Tie::AsHash;

$object = tied $s;
untie $s;

```

# DESCRIPTION

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

# ORIGINAL PERL 5 DOCUMENTATION

```
tie VARIABLE,CLASSNAME,LIST
        This function binds a variable to a package class that will
        provide the implementation for the variable. VARIABLE is the name
        of the variable to be enchanted. CLASSNAME is the name of a class
        implementing objects of correct type. Any additional arguments are
        passed to the appropriate constructor method of the class (meaning
        "TIESCALAR", "TIEHANDLE", "TIEARRAY", or "TIEHASH"). Typically
        these are arguments such as might be passed to the "dbm_open()"
        function of C. The object returned by the constructor is also
        returned by the "tie" function, which would be useful if you want
        to access other methods in CLASSNAME.

        Note that functions such as "keys" and "values" may return huge
        lists when used on large objects, like DBM files. You may prefer
        to use the "each" function to iterate over such. Example:

            # print out history file offsets
            use NDBM_File;
            tie(%HIST, 'NDBM_File', '/usr/lib/news/history', 1, 0);
            while (($key,$val) = each %HIST) {
                print $key, ' = ', unpack('L',$val), "\n";
            }
            untie(%HIST);

        A class implementing a hash should have the following methods:

            TIEHASH classname, LIST
            FETCH this, key
            STORE this, key, value
            DELETE this, key
            CLEAR this
            EXISTS this, key
            FIRSTKEY this
            NEXTKEY this, lastkey
            SCALAR this
            DESTROY this
            UNTIE this

        A class implementing an ordinary array should have the following
        methods:

            TIEARRAY classname, LIST
            FETCH this, key
            STORE this, key, value
            FETCHSIZE this
            STORESIZE this, count
            CLEAR this
            PUSH this, LIST
            POP this
            SHIFT this
            UNSHIFT this, LIST
            SPLICE this, offset, length, LIST
            EXTEND this, count
            DELETE this, key
            EXISTS this, key
            DESTROY this
            UNTIE this

        A class implementing a filehandle should have the following
        methods:

            TIEHANDLE classname, LIST
            READ this, scalar, length, offset
            READLINE this
            GETC this
            WRITE this, scalar, length, offset
            PRINT this, LIST
            PRINTF this, format, LIST
            BINMODE this
            EOF this
            FILENO this
            SEEK this, position, whence
            TELL this
            OPEN this, mode, LIST
            CLOSE this
            DESTROY this
            UNTIE this

        A class implementing a scalar should have the following methods:

            TIESCALAR classname, LIST
            FETCH this,
            STORE this, value
            DESTROY this
            UNTIE this

        Not all methods indicated above need be implemented. See perltie,
        Tie::Hash, Tie::Array, Tie::Scalar, and Tie::Handle.

        Unlike "dbmopen", the "tie" function will not "use" or "require" a
        module for you; you need to do that explicitly yourself. See
        DB_File or the Config module for interesting "tie"
        implementations.

        For further details see perltie, "tied VARIABLE".

tied VARIABLE
        Returns a reference to the object underlying VARIABLE (the same
        value that was originally returned by the "tie" call that bound
        the variable to a package.) Returns the undefined value if
        VARIABLE isn't tied to a package.

untie VARIABLE
        Breaks the binding between a variable and a package. (See tie.)
        Has no effect if the variable is not tied.

```

# PORTING CAVEATS

Please note that there are usually better ways attaching special functionality to arrays, hashes and scalars in Raku than using `tie`. Please see the documentation on [Custom Types](https://docs.raku.org/language/subscripts#Custom_types) for more information to handling the needs that Perl's `tie` fulfills in a more efficient way in Raku.

## Subs versus Methods

In Raku, the special methods of the tieing class, can be implemented as Raku `method`s, or they can be implemented as `our sub`s, both are perfectly acceptable. They can even be mixed, if necessary. But note that if you're depending on subclassing, that you must change the `package` to a `class` to make things work.

## Untieing

Because Raku does not have the concept of magic that can be added or removed, it is **not** possible to `untie` a variable. Note that the associated `UNTIE` sub/method **will** be called, so that any resources can be freed.

Potentially it would be possible to actually have any subsequent accesses to the tied variable throw an exception: perhaps it will at some point.

## Scalar variable tying versus Proxy

Because tying a scalar in Raku **must** be implemented using a `Proxy`, and it is currently not possible to mix in any additional behaviour into a `Proxy`, it is alas impossible to implement `UNTIE` and `DESTROY` for tied scalars at this point in time. Please note that `UNTIE` and `DESTROY` **are** supported for tied arrays and hashes.

## Tieing a file handle

Tieing a file handle is not yet implemented at this time. Mainly because I don't grok yet how to do that. As usual, patches and Pull Requests are welcome!

# AUTHOR

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

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

# COPYRIGHT AND LICENSE

Copyright 2018, 2019, 2020, 2021 Elizabeth Mattijsen

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

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


## dist_zef-l10n-L10N-EN.md
# NAME

L10N::EN - English localization of Raku

# SYNOPSIS

```
use L10N::NL;
zeg "Hallo wereld";
{
    gebruik L10N::EN;  # Note: -use- needs to be in outer localization
    say "Hello World";
}

```

# DESCRIPTION

L10N::EN contains the logic to provide a English localization of the Raku Programming Language.

Note that this is the same mapping as the core. This localization is mainly intended to allow switching back to the core language in a scope, while being in another localization.

# AUTHORS

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

# COPYRIGHT AND LICENSE

Copyright 2023 Raku Localization Team

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


## dist_zef-guifa-Intl-LanguageTaggish.md
# Intl::LanguageTaggish

A role to be implemented by different representations of a language/locale identifier.
It provides for the following three methods/attributes:

* `language`
  The language, generally in ISO 639 format (as either a `Str` or something that coerces accordingly)
* `region`
  The region, generally in ISO 3166/UN M.49 format (as either a `Str` or something that coerces accordingly)
* `bcp47`
  A BCP-47 representation of the tag, to the extent possible (as a `Str`). May be lossy.

## Raison d’être

While there are not many language tag standards, there are several in common use.
This role aims to define some common features to aid their interaction.

A `bcp47` method should provide conversion into a BCP-47-compliant string. For example,
Apple allows "English" or "Spanish" as valid identifiers for its `.lproj` identifiers.
So a theoretical `AppleLProj` class that does `LanguageTaggish` would output **English**
for `.language`, but for `bcp47`, would output **en**.

It is expected that class implementing `LanguageTaggish` will add additional methods
and attributes. In keeping with tradition established by other language tag frameworks
(in particular ICU), requested values not present should return the empty string.
The role handles this by default via its `FALLBACK` method.

In addition, each `LanguageTaggish` implementor is expected to also provide a method `

## Coercions into `LanguageTaggish`

Classes implementing `LanguageTaggish` register themselves on the first `use` statement to be available for coercion.
Optimally, programmers in international environments will know what tag is needed, however, when it's not possible, the `COERCE` method aims to do its best.
In priority order, classes judge whether they can handle the tag, and if so, will do the coercion.
**This approach is not (as of v0.1) finalized and may be adjusted.**

* `Intl::LanguageTag::BCP-47` (**:100priority**)
  This IETF BCP-47 representation (uses hyphens and subtags are limited to 8 characters).
* `Intl::LanguageTag::Unicode` (**:75priority**)
  The Unicode language tag standard (uses underscores generally, subtags may have any number of characters)
* `Intl::LanguageTag::POSIX` (**:50priority**)
  The standard langauge tag as used in POSIX (underscores, at symbols, and dots may delineate subtags)
* `Intl::LanguageTag::UnicodeLegacy` (**:25priority**)
  The legacy style Unicode langauge tag (underscores and at symbols delineate subtags, special characters like slash are valid as variant values)
* `Intl::LanguageTaggish::Fallback` (**:0priority**)
  A fallback that detects the first (and possible second) sequence of alpha characters as the language (and possible region).

Note that if you `use Intl::LanguageTag`, you will get the BCP-47 implementation, as it is currently the most common format.


## dist_github-labster-File-Spec-Case.md
# p6-File-Spec-Case

Check if your filesystem is case sensitive or case tolerant (insensitive)

## SYNOPSIS

```
use File::Spec::Case;
say File::Spec::Case.tolerant;  #tests case tolerance in $*CWD
my $folder = "/path/to/folder";
say "case sensitive"
    if File::Spec::Case.sensitive($folder, :no-write);
say "$folder is case-{ File::Spec::insensitive($folder) ?? 'in' !! ''}sensitive";

```

## DESCRIPTION

Given a directory, this module attempts to determine whether that particular part of the filesystem is case sensitive or insensitive. In order to be platform independendent, this module interacts with the filesystem to attempt to determine case, because nowadays it's entirely possible to support multiple case filesystems on Windows, Linux, and Mac OS X.

This module splits little-used functionality off from [File::Spec](https://github.com/FROGGS/p6-File-Spec), and has moved to its own module if you need it. Unlike in Perl 5, it now applies only to a specific directory -- with symlinks and multiple partitions, you can't assume anything beyond that.

## METHODS

### tolerant

```
method tolerant (Str:D $path = $*CWD, :$no_write = False )

```

Method `tolerant` now requires a path (as compared to Perl 5 File::Spec->case\_tolerant), below which it tests for case sensitivity. The default path it tests is $\*CWD. A :no-write parameter may be passed if you want to disable writing of test files (which is tried last).

```
File::Spec::Case.tolerant('foo/bar');
File::Spec::Case.tolerant('/etc', :no-write);

```

It will find case (in)sensitivity if any of the following are true, in increasing order of desperation:

* The $path passed contains <alpha> and no symbolic links.
* The $path contains <alpha> after the last symlink.
* Any folders in the path (under the last symlink, if applicable) contain a file matching <alpha>.
* Any folders in the path (under the last symlink, if applicable) are writable.

Otherwise, it returns the platform default.

### insensitive

A synonym for `.tolerant`.

### sensitive

An antonym for `.tolerant` -- that is, it returns `not tolerant`. Takes the same arguments as tolerant.

### default-case-tolerant

The method of last resort for `.tolerant`, this returns the default value for whether the platform is insensitive to case. If passed an OS string, it will look for the default on that OS instead.

The default is essentially what you'll get if you do a default install of your operating system.

### always-case-tolerant

Returns True if your OS is on the list of þe olde Turing machine systems of operating with case tolerance, False otherwise. If you pass another OS string, it will check that instead of your own OS.

This is used as a shortcut in `.tolerant` for machines which never support case-sensitive file naming.

## SEE ALSO

* [File::Spec](https://github.com/FROGGS/p6-File-Spec)

## AUTHOR

Brent "Labster" Laabs, 2013.

Contact the author at [bslaabs@gmail.com](mailto:bslaabs@gmail.com) or as labster on #perl6. File [bug reports](https://github.com/labster/p6-IO-File-Spec-Case/issues) on github.

## COPYRIGHT

This code is free software, licensed under the same terms as Perl 6; see the LICENSE file for details.


## dist_github-retupmoca-Crust-Middleware-Syslog.md
# Crust::Middleware::Syslog

```
use Crust::Builder;
use Crust::Middleware::Syslog;

builder {
    enable 'Syslog', ident => 'MyApp';
    $app;
}

```

or

```
use Crust::Middleware::Syslog;

$app = Crust::Middleware::Syslog.new($app);

```

And in your app:

```
%env<p6sgix.logger>('debug', 'Things happened!');

```


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

# NAME

Net::LibIDN - Perl 6 bindings for GNU LibIDN

# SYNOPSIS

```
use Net::LibIDN;

my $idna := Net::LibIDN.new;

my $domain := "m\xFC\xDFli.de";
my Int $code;
my $ace := $idna.to_ascii_8z($domain, 0, $code);
say "$ace $code"; # xn--mssli-kva.de 0

my $domain2 := $idna.to_unicode_8z8z($domain, 0, $code);
say "$domain2 $code"; # müssli.de 0

```

# DESCRIPTION

Net::LibIDN is a wrapper for the GNU LibIDN library. It provides bindings for its IDNA, Punycode, stringprep, and TLD functions. See Net::LibIDN::Punycode, Net::LibIDN::StringPrep, and Net::LibIDN::TLD for more documentation.

# METHODS

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

Converts a UTF8 encoded string *$input* to ASCII and returns the output. *$code*, if provided, is assigned to *IDNA\_SUCCESS* on success, or another error code otherwise.

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

Converts an ACE encoded domain name *$input* to UTF8 and returns the output. *$code*, if provided, is assigned to *IDNA\_SUCCESS* on success, or another error code otherwise.

# CONSTANTS

* Int **IDNA\_ACE\_PREFIX**

String containing the official IDNA prefix, "xn--".

## FLAGS

* Int **IDNA\_ALLOW\_UNASSIGNED**

Allow unassigned Unicode codepoints.

* Int **IDNA\_USE\_STD3\_ASCII\_RULES**

Check output to ensure it is a STD3 conforming hostname.

## ERRORS

* Int **IDNA\_SUCCESS**

Successful operation.

* Int **IDNA\_STRINGPREP\_ERROR**

Error during string preparation.

* Int **IDNA\_PUNYCODE\_ERROR**

Error during punycode operation.

* Int **IDNA\_CONTAINS\_NON\_LDH**

*IDNA\_USE\_STD3\_ASCII\_RULES* flag was passed, but the given string contained non-LDH ASCII characters.

* Int **IDNA\_CONTAINS\_MINUS**

*IDNA\_USE\_STD3\_ASCII\_RULES* flag was passed, but the given string contained a leading or trailing hyphen-minus (u002D).

* Int **IDNA\_INVALID\_LENGTH**

The final output string is not within the range of 1 to 63 characters.

* Int **IDNA\_NO\_ACE\_PREFIX**

The string does not begin with *IDNA\_ACE\_PREFIX* (for ToUnicode).

* Int **IDNA\_ROUNDTRIP\_VERIFY\_ERROR**

The ToASCII operation on the output string does not equal the input.

* Int **IDNA\_CONTAINS\_ACE\_PREFIX**

The input string begins with *IDNA\_ACE\_PREFIX* (for ToASCII).

* Int **IDNA\_ICONV\_ERROR**

Could not convert string to locale encoding.

* Int **IDNA\_MALLOC\_ERROR**

Could not allocate buffer (this is typically a fatal error).

* Int **IDNA\_DLOPEN\_ERROR**

Could not dlopen the libcidn DSO (only used internally in LibC).

# AUTHOR

Ben Davies [kaiepi@outlook.com](mailto:kaiepi@outlook.com)

# 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_zef-titsuki-Algorithm-BinaryIndexedTree.md
[![Actions Status](https://github.com/titsuki/raku-Algorithm-BinaryIndexedTree/workflows/test/badge.svg)](https://github.com/titsuki/raku-Algorithm-BinaryIndexedTree/actions)

# NAME

Algorithm::BinaryIndexedTree - data structure for cumulative frequency tables

# SYNOPSIS

```
use Algorithm::BinaryIndexedTree;

my $BIT = Algorithm::BinaryIndexedTree.new();
$BIT.add(5,10);
$BIT.get(0).say; # 0
$BIT.get(5).say; # 10
$BIT.sum(4).say; # 0
$BIT.sum(5).say; # 10

$BIT.add(0,10);
$BIT.sum(5).say; # 20

```

# DESCRIPTION

Algorithm::BinaryIndexedTree is the data structure for maintainig the cumulative frequencies.

## CONSTRUCTOR

### new

```
my $BIT = Algorithm::BinaryIndexedTree.new(%options);

```

#### OPTIONS

* `size => $size`

Sets table size. Default is 1000.

## METHODS

### add

```
$BIT.add($index, $value);

```

Adds given value to the index `$index`.

### sum

```
my $sum = $BIT.sum($index);

```

Returns sum of the values of items from index 0 to index `$index` inclusive.

### get

```
my $value = $BIT.get($index);

```

Returns the value at index `$index`.

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

The algorithm is from Fenwick, Peter M. "A new data structure for cumulative frequency tables." Software: Practice and Experience 24.3 (1994): 327-336.


## dist_zef-FRITH-Desktop-Notify-Progress.md
[![Actions Status](https://github.com/frithnanth/Perl6-Desktop-Notify-Progress/workflows/test/badge.svg)](https://github.com/frithnanth/Perl6-Desktop-Notify-Progress/actions)

# NAME

Desktop::Notify::Progress - Show the progress of processing in a notification popup

# SYNOPSIS

```
use Desktop::Notify::Progress;

my $fh = 'BigDataFile'.IO.open;
my $p := Desktop::Notify::Progress.new: :$fh, :title('Long data processing'), :timeout(2);
for $p -> $line {
  painfully-process($line);
}

```

```
use Desktop::Notify::Progress;

my @p = Seq.new(Desktop::Notify::Progress.new: :filename('BigDataFile'));
for @p -> $line {
  painfully-process($line);
}

```

# DESCRIPTION

Desktop::Notify::Progress is a small class that provides a way to show the progress of file processing using libnotify

## new(Str :$filename!, Str :$title?, Int :$timeout? = 0)

## new(IO::Handle :$fh!, :$title!, Int :$timeout? = 0)

## new(:&get!, Int :$size?, Str :$title!, Int :$timeout? = 0)

Creates a **Desktop::Notify::Progress** object.

The first form takes one mandatory argument: **filename**, which will be used as the notification title. Optionally one can pass an additional string which will be used as the notification title: **title**. Another optional parameter **timeout**, the number of seconds the notification will last until disappearing. The default is for the notification not to disappear until explicitly closed.

The second form requires both an opened file handler **fh** and the notification **title**. An optional **timeout** can be specified.

The third form takes a mandatory function **&get** which retrieves the next element, an optional total number of elements **$size**, and an optional **timeout**. If the **$size** parameter has been provided, the notification will show a percentage, otherwise it will show the current element number.

## Usage

A Desktop::Notify::Progress object has an **Iterable** role, so it can be used to read a file line by line. When initialized the object will read the file size, so it will be able to update the computation progress as a percentage in the notification window.

# Prerequisites

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

## Debian Linux

```
sudo apt-get install libnotify4

```

# Installation

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

```
$ zef install Desktop::Notify::Progress

```

This will install the Desktop::Notify module if not yet present.

# Testing

To run the tests:

```
$ prove -e "raku -Ilib"

```

# AUTHOR

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

# COPYRIGHT AND LICENSE

Copyright 2019 Fernando Santagata

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


## dist_github-azawawi-NCurses.md
# NCurses

[![Actions
Status](https://github.com/azawawi/raku-ncurses/workflows/test/badge.svg)](https://github.com/azawawi/raku-ncurses/actions)

NCurses provides a Raku native interface to the `ncurses` library for
terminal-independent screen I/O.

## Example

```
use NCurses;

# Initialize curses window
my $win = initscr() or die "Failed to initialize ncurses\n";
start_color;

# Initialize colors
init_pair(1, COLOR_WHITE, COLOR_RED);
init_pair(2, COLOR_WHITE, COLOR_BLUE);

# Print Hello World
color_set(1, 0);
mvaddstr( 10, 10, " Hello world " );
color_set(2, 0);
mvaddstr( LINES() - 2, 2, "Press any key to exit..." );

# Refresh (this is needed)
nc_refresh;

# Wait for a keypress
getch;

# Cleanup
LEAVE {
    delwin($win) if $win;
    endwin;
}

```

For more examples, please see the <examples> folder.

## Installation

* On Debian-based linux distributions, please use the following command:

```
$ sudo apt-get install libncurses6

```

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

```
$ brew update
$ brew install ncurses

```

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

```
$ zef install NCurses

```

## Environment variables

The following environment variables can be used to specify the location of the
different `ncurses` libraries:

* `RAKU_NCURSES_LIB`
* `RAKU_NCURSES_PANEL_LIB`
* `RAKU_NCURSES_MENU_LIB`
* `RAKU_NCURSES_FORM_LIB`

## Troubleshooting

* To fix a broken or messed up terminal after a crash, please type `reset` to
  reset your terminal into its original state.

## Testing

* To run tests:

```
$ prove -ve "raku -Ilib"

```

* To run all tests including author tests (Please make sure
  [Test::Meta](https://github.com/jonathanstowe/Test-META) is installed):

```
$ zef install Test::META
$ AUTHOR_TESTING=1 prove -e "raku -Ilib"

```

## Author

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

## License

MIT License


## dist_zef-grondilu-Bitcoin.md
# Bitcoin raku tools

## Synopses

### Bitcoin

```
use Bitcoin;

# A private key is just a 256-bits integer
say ^2**256 .pick;

# mix it with the Bitcoin::PrivateKey role to add bitcoin-related methods
say my $key = ^2**256 .pick but Bitcoin::PrivateKey;

# There is a very small chance that mixing will fail as the key range does not
# quite go up to 2**256.  See documentation about secp256k1 for details.
my $key = 2**256 - 123 but Bitcoin::PrivateKey;  # dies with 'index out of range' message

# Otherwise, the Bitcoin::PrivateKey role mainly defines a wif and address method.
# So far, the generated address is always the P2PKH one.
say $key.wif;                     # L2sJY3d2U5kzZSXrREDACTEDW3TbBidYQPvt3REDACTED84e55wr
say $key.wif: :uncompressed;      # 5K6WMB7MGenK2TdScgSp2B5REDACTEDyxbeamdaREDACTEDPvbt
say $key.address;                 # 1JGoEGREDACTEDzGTBQhDu15pWa5WgDjLa
say $key.address: :uncompressed;  # 13UpWYvdnJZuMREDACTEDDTNQEsrLpyGWd

```

### BIP32

```
use BIP32;

# master key generation
#   - random, defaut entropy is 16 bytes
my MasterKey $m .= new;
#   - from a seed
my MasterKey $m .= new: my $seed = blob8.new: ^256 .roll: 32;

# key derivation
print $m/0;
print $m/0/0h;

```

### BIP39

```
use BIP39;

# create random mnemonics
say Mnemonic.new: 24;     # twenty four words
say Mnemonic.new;         # default is twelve

# create mnemonics from entropy
my blob8 $entropy .= new: 0 xx 16;

say Mnemonic.new: $entropy;    # (abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about)

%*ENV<LANG>='zh_CN';
say Mnemonic.new: $entropy;    # 的的的的的的的的的的的在

%*ENV<LANG>='fr_FR';
say Mnemonic.new: $entropy;    # (abaisser abaisser abaisser abaisser abaisser abaisser abaisser abaisser abaisser abaisser abaisser abeille)

# extract a BIP32-compatible seed
say Mnemonic.new.Blob;
# same, but with a passphrase
say Mnemonic.new.Blob('sezame');

```

## LICENSE

This library is free software. It is released on the same terms as Raku
itself. See the 'COPYRIGHT' and 'LICENSE' files for more information.

THIS SOFTWARE IS PROVIDED WITH NO WARRANTY WHATSOEVER. USE AT YOUR OWN RISK.


## parametricrolehow.md
role Metamodel::ParametricRoleHOW

Represents a non-instantiated, parameterized, role.

```raku
    class Metamodel::ParametricRoleHOW
        does Metamodel::Naming
        does Metamodel::Documenting
        does Metamodel::Versioning
        does Metamodel::MethodContainer
        does Metamodel::PrivateMethodContainer
        does Metamodel::MultiMethodContainer
        does Metamodel::AttributeContainer
        does Metamodel::RoleContainer
        does Metamodel::MultipleInheritance
        does Metamodel::Stashing
        does Metamodel::TypePretense
        does Metamodel::RolePunning
        does Metamodel::ArrayType {}

```

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

A `Metamodel::ParametricRoleHOW` represents a non-instantiated, possibly parameterized, role:

```raku
(role Zape[::T] {}).HOW.say;# OUTPUT: «Perl6::Metamodel::ParametricRoleHOW.new␤»
(role Zape {}).HOW.say; # OUTPUT: «Perl6::Metamodel::ParametricRoleHOW.new␤»

```

As usual, `.new_type` will create a new object of this class.

```raku
my \zipi := Metamodel::ParametricRoleHOW.new_type( name => "zape", group => "Zape");
say zipi.HOW; # OUTPUT: «Perl6::Metamodel::ParametricRoleHOW.new␤»

```

The extra `group` argument will need to be used to integrate it in a parametric role group, which will need to be defined in advance.

*Note*: As most of the `Metamodel` classes, this one is here mainly for illustration purposes and it's not intended for the final user to instantiate, unless their intention is really to create a parametric role group.


## dist_cpan-JGOFF-Pod-To-HTMLBody.md
# Pod-To-HTMLBody [Build Status](http://travis-ci.org/drforr/perl6-Pod-To-HTMLBody)

# Pod-To-HTMLBody

Generates a HTML fragment

Please note that there's a Pod::To::Tree module that will get broken out once
it handles the test cases, and Pod::To::HTMLBody will use that instead of
surrounding the ::To::Tree module.

# Installation

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

```
    zef update && zef install Pod::To::HTMLBody

```

## Testing

To run tests:

```
    prove -e perl6

```

## Author

Jeffrey Goff, DrForr on #perl6, <https://github.com/drforr/>

## License

Artistic License 2.0


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

# NAME

Raku port of Perl's lcfirst() / ucfirst() built-ins

# SYNOPSIS

```
use P5lcfirst;

say lcfirst "FOOBAR"; # fOOBAR
with "ZIPPO" {
    say lcfirst;  # zIPPO
}

say ucfirst "foobar"; # Foobar
with "zippo" {
    say ucfirst;  # Zippo
}

```

# DESCRIPTION

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

# ORIGINAL PERL 5 DOCUMENTATION

```
lcfirst EXPR
lcfirst Returns the value of EXPR with the first character lowercased.
        This is the internal function implementing the "\l" escape in
        double-quoted strings.

        If EXPR is omitted, uses $_.

        This function behaves the same way under various pragmata, such as
        in a locale, as "lc" does.

ucfirst EXPR
ucfirst Returns the value of EXPR with the first character in uppercase
        (titlecase in Unicode). This is the internal function implementing
        the "\u" escape in double-quoted strings.

        If EXPR is omitted, uses $_.

        This function behaves the same way under various pragma, such as
        in a locale, as "lc" does.

```

# PORTING CAVEATS

In future language versions of Raku, it will become impossible to access the `$_` variable of the caller's scope, because it will not have been marked as a dynamic variable. So please consider changing:

```
lcfirst;

```

to either:

```
lcfirst($_);

```

or, using the subroutine as a method syntax, with the prefix `.` shortcut to use that scope's `$_` as the invocant:

```
.&lcfirst;

```

# AUTHOR

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

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

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

# COPYRIGHT AND LICENSE

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

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

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