## dist_cpan-UFOBAT-IoC.md
[![Build Status](https://travis-ci.org/ufobat/perl6-ioc.svg?branch=master)](https://travis-ci.org/ufobat/perl6-ioc)

# NAME

IoC - Wire your application components together using inversion of control

# SYNOPSIS

```
use IoC;

my $c = container 'myapp' => contains {

    service 'logfile' => 'logfile.txt';

    service 'logger' => {
        'class'        => 'MyLogger',
        'lifecycle'    => 'Singleton',
        'dependencies' => {'logfile' => 'logfile'},
    };

    service 'storage' => {
        'lifecycle' => 'Singleton',
        'block'     => sub {
            ...
            return MyStorage.new();
        },
    };

    service 'app' => {
        'class'        => 'MyApp',
        'lifecycle'    => 'Signleton',
        'dependencies' => {
            'logger'  => 'logger',
            'storage' => 'storage',
        },
    };

};

my $app = $c.resolve(service => 'app');
$app.run();

```

# DESCRIPTION

IoC is a port of stevan++'s Perl 5 module Bread::Board.

# INVERSION OF CONTROL

Inversion of control is a way of keeping all your component creation logic in one place. Instead of creating an object and explicitly pass it around everywhere, one could just make a *container* of all these components and allow the components to cleanly interact with each other as *services*.

# EXPORTED FUNCTIONS

* **container**

Creates a new IoC::Container object. In the block you create your services.

* **service**

Adds services to your container, bringing your components together. See `IoC::Service` for more information on this.

# BUGS

All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or post an issue to <http://github.com/jasonmay/perl6-ioc/>

# REFERENCE

* IoC::Container - Container of all your application components
* IoC::Service - Service representing a component in your application

# ACKNOWLEDGEMENTS

* Thanks to Stevan Little who is the original author of Perl 5's Bread::Board

# AUTHOR

Jason May, [jason.a.may@gmail.com](mailto:jason.a.may@gmail.com)

# LICENSE

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


## dist_zef-coke-Slang-Date_1.md
# Slang::Date

A Slang for Raku that adds support for literal dates in ISO-8601 style.

## Examples

Replaces the ISO String with a QAST node that generates a call to Date.new...;

```
my $a = 2023-01-13;
say "Happy Friday the 13th" if  $a.day-of-week == 5;

```

Invalid dates will error out as expected:

```
my $b = 2023-01-99;

```

```
Day out of range. Is: 99, should be in 1..31
  in block <unit> at -e line 1

```

## Notes

Requires a 4 digit year, 2 digit month, and 2 digit day.


## dist_zef-librasteve-Contact.md
[![](https://img.shields.io/badge/License-Artistic%202.0-0298c3.svg)](https://opensource.org/licenses/Artistic-2.0) [![test](https://github.com/librasteve/raku-Contact/actions/workflows/test.yml/badge.svg)](https://github.com/librasteve/raku-Contact/actions/workflows/test.yml)

# Contact

## Synopsis

```
#!/usr/bin/env raku
use v6.d;

use lib '../lib';
use Data::Dump::Tree;

use Contact;

my ( $country, $text );

#[
$country = 'USA';

$text = q:to/END/;
John Doe,
123, Main St.,
Springfield,
IL 62704
END
#]

#[
$country = 'UK';

$text = q:to/END/;
Dr. Jane Doe,
Sleepy Cottage,
123, Badgemore Lane,
Henley-on-Thames,
Oxon,
RG9 2XX
END
#]

my Contact $contact .= new: :$country, :$text;

ddt  $contact;
say ~$contact;
say  $contact.to-json;

```

*you are welcome to view / raise issues / make PRs if you would like to contribute...*

### TODOs

* add Email::Address (dependency)
* add more countries (GE, FR ...)

### Copyright

copyright(c) 2023 Henley Cloud Consulting Ltd.


## dist_zef-grizzlysmit-Display-Listings.md
## Chunk 1 of 2
# Display::Listings

## Table of Contents

* [NAME](#name)
* [AUTHOR](#author)
* [VERSION](#version)
* [TITLE](#title)
* [SUBTITLE](#subtitle)
* [COPYRIGHT](#copyright)
* [Introduction](#introduction)
* [list-by(…)](#list-by)

  * [Examples:](#examples)

    * [A more complete example:](#a-more-complete-example)
    * [Another example:](#another-example)

      * [An Example of the above code **`list-editors-backups(…)`** at work:](#An-Example-of-the-above-code-list-editors-backups-at-work)
* [The default callbacks](#the-default-callbacks)

  * [The hash of hashes stuff](#the-hash-of-hashes-stuff)
  * [The array of hashes stuff](#the-array-of-hashes-stuff)

# NAME

Display::Listings

# AUTHOR

Francis Grizzly Smit ([grizzly@smit.id.au](mailto:grizzly@smit.id.au))

# VERSION

0.1.9

# TITLE

Display::Listings

# SUBTITLE

A Raku module for displaying lines in a listing.

# COPYRIGHT

LGPL V3.0+ [LICENSE](https://github.com/grizzlysmit/Display-Listings/blob/main/LICENSE)

[Top of Document](#table-of-contents)

# Introduction

A **Raku** module for managing the users GUI Editor preferences in a variety of programs.

### list-by(…)

This is a multi sub it has two signatures.

```
multi sub list-by(Str:D $prefix, Bool:D $colour is copy, Bool:D $syntax, Int:D $page-length,
                  Regex:D $pattern, Str:D $key-name, Str:D @fields, %defaults, %rows,
                  Int:D :$start-cnt = -3, Bool:D :$starts-with-blank = True,
                  Str:D :$overline-header = '', Bool:D :$underline-header = True, Str:D :$underline = '=',
                  Bool:D :$put-line-at-bottom = True, Str:D :$line-at-bottom = '=', Bool:D :$sort = True,
                  Str:D :%flags = default-zip-flags($key-name, @fields),
                  Str:D :%between-flags = default-zip-flags($key-name, @fields),
                  Str:D :%head-flags = default-zip-flags($key-name, @fields),
                  Str:D :%between-head-flags = default-zip-flags($key-name, @fields),
                  :&include-row:(Str:D $pref, Regex $pat, Str:D $k, Str:D @f, %r --> Bool:D) = &default-include-row,
                  :&head-value:(Int:D $idx, Str:D $fld, Bool:D $c, Bool:D $syn, Str:D @flds --> Str:D) = &default-head-value,
                  :&head-between:(Int:D $idx, Str:D $fld, Bool:D $c, Bool:D $syn, Str:D @flds --> Str:D) = &default-head-between,
                  :&field-value:(Int:D $idx, Str:D $fld, $val, Bool:D $c, Bool:D $syn, Str:D @flds, %r --> Str:D) = &default-field-value,
                  :&between:(Int:D $idx, Str:D $fld, Bool:D $c, Bool:D $syn, Str:D @flds, %r --> Str:D) = &default-between,
                  :&row-formatting:(Int:D $cnt, Bool:D $c, Bool:D $syn --> Str:D) = &default-row-formatting --> Bool:D) is export {

```

[Top of Document](#table-of-contents)

And

```
multi sub list-by(Str:D $prefix, Bool:D $colour is copy, Bool:D $syntax, Int:D $page-length,
                  Regex:D $pattern, Str:D @fields, %defaults, @rows, Int:D :$start-cnt = -3,
                  Bool:D :$starts-with-blank = True,
                  Str:D :$overline-header = '', Bool:D :$underline-header = True, Str:D :$underline = '=',
                  Bool:D :$put-line-at-bottom = True, Str:D :$line-at-bottom = '=', Bool:D :$sort = True,
                  Str:D :%flags = default-zip-flags(@fields),
                  Str:D :%between-flags = default-zip-flags(@fields),
                  Str:D :%head-flags = default-zip-flags(@fields),
                  Str:D :%between-head-flags = default-zip-flags(@fields),
                  :&include-row:(Str:D $pref, Regex:D $pat, Int:D $i, Str:D @f, %r --> Bool:D) = &default-include-row-array,
                  :&head-value:(Int:D $idx, Str:D $fld, Bool:D $c, Bool:D $syn, Str:D @flds --> Str:D) = &default-head-value-array,
                  :&head-between:(Int:D $idx, Str:D $fld, Bool:D $c, Bool:D $syn, Str:D @flds --> Str:D) = &default-head-between-array,
                  :&field-value:(Int:D $idx, Str:D $fld, $val, Bool:D $c, Bool:D $syn, Str:D @flds, %r --> Str:D) = &default-field-value-array,
                  :&between:(Int:D $idx, Str:D $fld, Bool:D $c, Bool:D $syn, Str:D @flds, %r --> Str:D) = &default-between-array,
                  :&row-formatting:(Int:D $cnt, Bool:D $c, Bool:D $syn --> Str:D) = &default-row-formatting-array --> Bool:D) is export {

```

**Note: you have to be careful writing your own callbacks like `:&include-row` you need to get the signature of said callback exactly right or you will run into difficult to debug errors, with no version of the `list-by` multi sub matching etc.**

[Top of Document](#table-of-contents)

### Examples:

```
use Display::Listings;

my Str:D $prefix = '';
my Str:D $key-name = 'key';
my Str:D @fields = 'host', 'port', 'comment';
my   %defaults = port => 22;

my   %rows = one => { host => 'example.com', type => 'host', port => 22 },
             two => { type => 'alias', host => 'one', comment => 'An alias' },
             three => { port => 345, host => 'www.smit.id.au', type => 'host',
                                                    comment => 'mine all mine' };
my Bool:D $colour = False;
my Bool:D $syntax = True;
my Int:D $page-length = 20;
my Regex:D $pattern = rx:i/ ^ .* 'smit' .* $/;

my @rows = {key => 'one', host => 'example.com', type => 'host', port => 22 },
           { type => 'alias', host => 'one', comment => 'An alias', key => 'two', },
           { port => 345, host => 'www.smit.id.au', type => 'host',
                                            comment => 'mine all mine', key => 'three' };

list-by($prefix, $colour, $syntax, $page-length, $pattern, $key-name,
                                                         @fields, %defaults, %rows);

list-by($prefix, $colour, $syntax, $page-length, $pattern, @fields, %defaults, @rows);

$pattern = rx/ ^ .* $/;

list-by($prefix, $colour, $syntax, $page-length, $pattern, $key-name,
                                                         @fields, %defaults, %rows);

list-by($prefix, $colour, $syntax, $page-length, $pattern,
                                                         @fields, %defaults, @rows);

```

[Top of Document](#table-of-contents)

#### A more complete example:

```
use Terminal::ANSI::OO :t;
use Display::Listings;

sub list-by-all(Str:D $prefix, Bool:D $colour, Bool:D $syntax,
                    Int:D $page-length, Regex:D $pattern --> Bool:D) is export {
    my Str:D $key-name = 'key';
    my Str:D @fields = 'host', 'port', 'comment';
    my   %defaults = port => 22;
    sub include-row(Str:D $prefix, Regex:D $pattern, Str:D $key,
                                                Str:D @fields, %row --> Bool:D) {
        return True if $key.starts-with($prefix, :ignorecase) && $key ~~ $pattern;
        for @fields -> $field {
            my Str:D $value = '';
            with %row{$field} { #`««« if %row{$field} does not exist then a Any
                                      will be returned, and if some cases, you
                                      may return undefined values so use some
                                      sort of guard this is one way to do that,
                                      you could use %row{$field}:exists or
                                      :!exists or // perhaps.
                                      TIMTOWTDI rules as always. »»»
                $value = ~%row{$field};
            }
            return True if $value.starts-with($prefix, :ignorecase)
                                                         && $value ~~ $pattern;
        }
        return False;
    } # sub include-row(Str:D $prefix, Regex:D $pattern,
                                        Str:D $key, @fields, %row --> Bool:D) #
    sub head-value(Int:D $indx, Str:D $field, Bool:D $colour,
                                        Bool:D $syntax, Str:D @fields --> Str:D) {
        if $syntax {
            t.color(0, 255, 255) ~ $field;
        } elsif $colour {
            t.color(0, 255, 255) ~ $field;
        } else {
            return $field;
        }
    } #`««« sub head-value(Int:D $indx, Str:D $field,
                                        Bool:D $colour, Bool:D $syntax,
                                        Str:D @fields --> Str:D) »»»
    sub head-between(Int:D $idx, Str:D $field, Bool:D $colour,
                                        Bool:D $syntax, Str:D @fields --> Str:D) {
        if $colour {
            if $syntax {
                given $field {
                    when 'key'     { return t.color(0, 255, 255) ~ ' sep '; }
                    when 'host'    { return t.color(0, 255, 255) ~ ' : ';   }
                    when 'port'    { return t.color(0, 255, 255)   ~ ' # ';   }
                    when 'comment' { return t.color(0, 0, 255)   ~ '  ';    }
                    default { return ''; }
                }
            } else {
                given $field {
                    when 'key'     { return t.color(0, 255, 255)   ~ ' sep '; }
                    when 'host'    { return t.color(0, 255, 255)   ~ ' : ';   }
                    when 'port'    { return t.color(0, 255, 255)   ~ ' # ';   }
                    when 'comment' { return t.color(0, 255, 255)   ~ '  ';    }
                    default { return ''; }
                }
            }
        } else {
            given $field {
                when 'key'     { return ' sep '; }
                when 'host'    { return ' : ';   }
                when 'port'    { return ' # ';   }
                when 'comment' { return '  ';    }
                default        { return '';      }
            }
        }
    } #`««« sub head-between(Int:D $idx, Str:D $field, Bool:D $colour,
                            Bool:D $syntax, Str:D @fields --> Str:D) »»»
    sub field-value(Int:D $idx, Str:D $field, $value, Bool:D $colour,
                        Bool:D $syntax, Str:D @fields, %row --> Str:D) {
        if $syntax {
            given $field {
                when 'key'     { return t.color(0, 255, 255) ~ ~$value; }
                when 'host'    {
                    my Str:D $type = %row«type»;
                    if $type eq 'host' {
                        return t.color(255, 0, 255) ~ ~$value;
                    } else {
                        return t.color(0, 255, 255) ~ ~$value;
                    }
                }
                when 'port'    {
                    my Str:D $type = %row«type»;
                    if $type eq 'host' {
                        return t.color(255, 0, 255) ~ ~$value;
                    } else {
                        return t.color(255, 0, 255) ~ '';
                    }
                }
                when 'comment' { return t.color(0, 0, 255) ~ ~$value; }
                default        { return t.color(255, 0, 0) ~ '';      }
            } # given $field #
        } elsif $colour {
            given $field {
                when 'key'     { return t.color(0, 0, 255) ~ ~$value; }
                when 'host'    { return t.color(0, 0, 255) ~ ~$value; }
                when 'port'    {
                    my Str:D $type = %row«type»;
                    if $type eq 'host' {
                        return t.color(0, 0, 255) ~ ~$value;
                    } else {
                        return t.color(0, 0, 255) ~ '';
                    }
                }
                when 'comment' { return t.color(0, 0, 255) ~ ~$value; }
                default        { return t.color(255, 0, 0) ~ '';      }
            }
        } else {
            given $field {
                when 'key'     { return ~$value; }
                when 'host'    { return ~$value; }
                when 'port'    {
                    my Str:D $type = %row«type»;
                    if $type eq 'host' {
                        return ~$value;
                    } else {
                        return '';
                    }
                }
                when 'comment' { return ~$value; }
                default        { return '';      }
            }
        }
    } #`««« sub field-value(Int:D $idx, Str:D $field, $value, Bool:D
                            $colour, Bool:D $syntax, Str:D @fields, %row --> Str:D) »»»
    sub between(Int:D $idx, Str:D $field, Bool:D $colour, Bool:D $syntax,
                                                Str:D @fields, %row --> Str:D) {
        if $syntax {
                given $field {
                    when 'key'     {
                        my Str:D $type = %row«type»;
                        if $type eq 'host' {
                            return t.color(255, 0, 0) ~ '  => ';
                        } else {
                            return t.color(255, 0, 0) ~ ' --> ';
                        }
                    }
                    when 'host'    {
                        my Str:D $type = %row«type»;
                        if $type eq 'host' {
                            return t.color(255, 0, 0) ~ ' : ';
                        } else {
                            return t.color(255, 0, 0) ~ '   ';
                        }
                    }
                    when 'port'    { return t.color(0, 0, 255) ~ ' # '; }
                    when 'comment' { return t.color(0, 0, 255) ~ '  ';  }
                    default        { return t.color(255, 0, 0) ~ '';    }
                }
        } elsif $colour {
                given $field {
                    when 'key'     {
                        my Str:D $type = %row«type»;
                        if $type eq 'host' {
                            return t.color(0, 0, 255) ~ '  => ';
                        } else {
                            return t.color(0, 0, 255) ~ ' --> ';
                        }
                    }
                    when 'host'    {
                        my Str:D $type = %row«type»;
                        if $type eq 'host' {
                            return t.color(0, 0, 255) ~ ' : ';
                        } else {
                            return t.color(0, 0, 255) ~ '   ';
                        }
                    }
                    when 'port'    { return t.color(0, 0, 255) ~ ' # '; }
                    when 'comment' { return t.color(0, 0, 255) ~ '  ';  }
                    default        { return t.color(255, 0, 0) ~ '';    }
                }
        } else {
                given $field {
                    when 'key'     {
                        my Str:D $type = %row«type»;
                        if $type eq 'host' {
                            return '  => ';
                        } else {
                            return ' --> ';
                        }
                    }
                    when 'host'    {
                        my Str:D $type = %row«type»;
                        if $type eq 'host' {
                            return ' : ';
                        } else {
                            return '   ';
                        }
                    }
                    when 'port'    { return ' # '; }
                    when 'comment' { return '  ';  }
                    default        { return '';    }
                }
        }
    } #`««« sub between(Int:D $idx, Str:D $field, Bool:D $colour,
                    Bool:D $syntax, Str:D @fields, %row --> Str:D) »»»
    sub row-formatting(Int:D $cnt, Bool:D $colour, Bool:D $syntax --> Str:D) {
        if $colour {
            if $syntax {
                return t.bg-color(255, 0, 255) ~ t.bold ~ t.bright-blue
                                  if $cnt == -3; # three heading lines. #
                return t.bg-color(0, 0, 127) ~ t.bold ~ t.bright-blue
                                                          if $cnt == -2;
                return t.bg-color(255, 0, 255) ~ t.bold ~ t.bright-blue
                                                          if $cnt == -1;
                return (($cnt % 2 == 0) ?? t.bg-yellow !!
                                  t.bg-color(0,255,0)) ~ t.bold ~ t.bright-blue;
            } else {
                return t.bg-color(255, 0, 255) ~ t.bold ~ t.bright-blue
                                                          if $cnt == -3;
                return t.bg-color(0, 0, 127) ~ t.bold ~ t.bright-blue
                                                          if $cnt == -2;
                return t.bg-color(255, 0, 255) ~ t.bold ~ t.bright-blue
                                                          if $cnt == -1;
                return (($cnt % 2 == 0) ?? t.bg-yellow !!
                              t.bg-color(0,255,0)) ~ t.bold ~ t.bright-blue;
            }
        } else {
            return '';
        }
    } #`««« sub row-formatting(Int:D $cnt, Bool:D $colour, Bool:D $syntax --> Str:D) »»»
    return list-by($prefix, $colour, $syntax, $page-length, $pattern, $key-name, @fields,
                            %defaults, %the-lot, :&include-row, :&head-value, :&head-between,
                            :&field-value, :&between, :&row-formatting);
} #`««« sub list-by-all(Str:D $prefix, Bool:D $colour is copy, Bool:D $syntax,
                        Int:D $page-length, Regex:D $pattern --> Bool:D) is export »»»

```

[Top of Document](#table-of-contents)

#### Another example

```
use Terminal::ANSI::OO :t;
use Display::Listings;
use File::Utils;

sub list-editors-backups(Str:D $prefix,
                         Bool:D $colour is copy,
                         Bool:D $syntax,
                         Regex:D $pattern,
                         Int:D $page-length --> Bool:D) is export {
    $colour = True if $syntax;
    my IO::Path @backups = $editor-config.IO.dir(:test(rx/ ^
                                                           'editors.' \d ** 4 '-' \d ** 2 '-' \d ** 2
                                                               [ 'T' \d **2 [ [ '.' || ':' ] \d ** 2 ] ** {0..2} [ [ '.' || '·' ] \d+
                                                                   [ [ '+' || '-' ] \d ** 2 [ '.' || ':' ] \d ** 2 || 'z' ]?  ]?
                                                               ]?
                                                           $
                                                         /
                                                       )
                                                );
    my $actions = EditorsActions;
    @backups .=grep: -> IO::Path $fl {
                                my @file = $fl.slurp.split("\n");
                                Editors.parse(@file.join("\x0A"), :enc('UTF-8'), :$actions).made;
                            };
    @backups .=sort;
    my @_backups = @backups.map: -> IO::Path $f {
          my %elt = backup => $f.basename, perms => symbolic-perms($f, :$colour, :$syntax),
                      user => $f.user, group => $f.group, size => $f.s, modified => $f.modified;
          %elt;
    };
    my Str:D @fields = 'perms', 'size', 'user', 'group', 'modified', 'backup';
    my       %defaults;
    my Str:D %fancynames = perms => 'Permissions', size => 'Size',
                             user => 'User', group => 'Group',
                             modified => 'Date Modified', backup => 'Backup';
    sub include-row(Str:D $prefix, Regex:D $pattern, Int:D $idx, Str:D @fields, %row --> Bool:D) {
        my Str:D $value = ~(%row«backup» // '');
        return True if $value.starts-with($prefix, :ignorecase) && $value ~~ $pattern;
        return False;
    } # sub include-row(Str:D $prefix, Regex:D $pattern, Int:D $idx, Str:D @fields, %row --> Bool:D) #
    sub head-value(Int:D $indx, Str:D $field, Bool:D $colour, Bool:D $syntax, Str:D @fields --> Str:D) {
        #dd $indx, $field, $colour, $syntax, @fields;
        if $colour {
            if $syntax {
                return t.color(0, 255, 255) ~ %fancynames{$field};
            } else {
                return t.color(0, 255, 255) ~ %fancynames{$field};
            }
        } else {
            return %fancynames{$field};
        }
    } # sub head-value(Int:D $indx, Str:D $field, Bool:D $colour, Bool:D $syntax, Str:D @fields --> Str:D) #
    sub head-between(Int:D $indx, Str:D $field, Bool:D $colour, Bool:D $syntax, Str:D @fields --> Str:D) {
        return ' ';
    } # sub head-between(Int:D $indx, Str:D $field, Bool:D $colour, Bool:D $syntax, Str:D @fields --> Str:D) #
    sub field-value(Int:D $idx, Str:D $field, $value, Bool:D $colour, Bool:D $syntax, Str:D @fields, %row --> Str:D) {
        my Str:D $val = ~($value // ''); #`««« assumming $value is a Str:D »»»
        #dd $val, $value, $field;
        if $syntax {
            given $field {
                when 'perms'    { return $val; }
                when 'size'     {
                    my Int:D $size = +$value;
                    return t.color(255, 0, 0) ~ format-bytes($size);
                }
                when 'user'     { return t.color(255, 255, 0) ~ uid2username(+$value);    }
                when 'group'    { return t.color(255, 255, 0) ~ gid2groupname(+$value);   }
                when 'modified' {
                    my Instant:D $m = +$value;
                    my DateTime:D $dt = $m.DateTime.local;
                    return t.color(0, 0, 235) ~ $dt.Str;
                }
                when 'backup'   { return t.color(255, 0, 255) ~ $val; }
                default         { return t.color(255, 0, 0) ~ $val;   }
            } # given $field #
        } elsif $colour {
            given $field {
                when 'perms'    { return $val; }
                when 'size'     {
                    my Int:D $size = +$value;
                    return t.color(0, 0, 255) ~ format-bytes($size);
                }
                when 'user'     { return t.color(0, 0, 255) ~ uid2username(+$value);    }
                when 'group'    { return t.color(0, 0, 255) ~ gid2groupname(+$value);   }
                when 'modified' {
                    my Instant:D $m = +$value;
                    my DateTime:D $dt = $m.DateTime.local;
                    return t.color(0, 0, 255) ~ $dt.Str;
                }
                when 'backup'   { return t.color(0, 0, 255) ~ $val;   }
                default         { return t.color(255, 0, 0) ~ $val;   }
            } # given $field #
        } else {
            given $field {
                when 'perms'    { return $val; }
                when 'size'     {
                    my Int:D $size = +$value;
                    return format-bytes($size);
                }
                when 'user'     { return uid2username(+$value);    }
                when 'group'    { return gid2groupname(+$value);   }
                when 'modified' {
                    my Instant:D $m = +$value;
                    my DateTime:D $dt = $m.DateTime.local;
                    return $dt.Str;
                }
                when 'backup'   { return $val;   }
                default         { return $val;   }
            } # given $field #
        }
    } # sub field-value(Int:D $idx, Str:D $field, $value, Bool:D $colour, Bool:D $syntax, Str:D @fields, %row --> Str:D) #
    sub between(Int:D $idx, Str:D $field, Bool:D $colour, Bool:D $syntax, Str:D @fields, %row --> Str:D) {
        return ' ';
    } # sub between(Int:D $idx, Str:D $field, Bool:D $colour, Bool:D $syntax, Str:D @fields, %row --> Str:D) #
    sub row-formatting(Int:D $cnt, Bool:D $colour, Bool:D $syntax --> Str:D) {
        if $colour {
            if $syntax {
                return t.bg-color(255, 0, 255) ~ t.bold ~ t.bright-blue if $cnt == -3; # three heading lines. #
                return t.bg-color(0, 0, 127) ~ t.bold ~ t.bright-blue if $cnt == -2;
                return t.bg-color(255, 0, 255) ~ t.bold ~ t.bright-blue if $cnt == -1;
                return (($cnt % 2 == 0) ?? t.bg-yellow !! t.bg-color(0,195,0)) ~ t.bold ~ t.bright-blue;
            } else {
                return t.bg-color(255, 0, 255) ~ t.bold ~ t.bright-blue if $cnt == -3;
                return t.bg-color(0, 0, 127) ~ t.bold ~ t.bright-blue if $cnt == -2;
                return t.bg-color(255, 0, 255) ~ t.bold ~ t.bright-blue if $cnt == -1;
                return (($cnt % 2 == 0) ?? t.bg-yellow !! t.bg-color(0,195,0)) ~ t.bold ~ t.bright-blue;
            }
        } else {
            return '';
        }
    } # sub row-formatting(Int:D $cnt, Bool:D $colour, Bool:D $syntax --> Str:D) #
    return list-by($prefix, $colour, $syntax, $page-length,
                  $pattern, @fields, %defaults, @_backups,
                  :!sort,
                  :&include-row,
                  :&head-value,
                  :&head-between,
                  :&field-value,
                  :&between,
                  :&row-formatting);
} #`««« sub list-editors-backups(Str:D $prefix,
                         Bool:D $colour is copy,
                         Bool:D $syntax,
                         Regex:D $pattern,
                         Int:D $page-length --> Bool:D) is export »»»

```

[Top of Document](#table-of-contents)

#### An Example of the above code **`list-editors-backups(…)`** at work:

![image not available here go to the github page](/docs/images/sc-list-editors-backups.png)

[Top of Document](#table-of-contents)

## The default callbacks

### The hash of hashes stuff

```
sub default-include-row(Str:D $prefix, Regex:D $pattern, Str:D $key, Str:D @fields, %row --> Bool:D) is export {
    return True if $key.starts-with($prefix, :ignorecase) && $key ~~ $pattern;
    for @fields -> $field {
        my Str:D $value = '';
        with %row{$field} { #`««« if %row{$field} does not exist then a Any will be retured,
                                  and if some cases, you may return undefined values so use
                                  some sort of guard this is one way to do that, you could
                                  use %row{$field}:exists or :!exists or // perhaps.
                                  TIMTOWTDI rules as always. »»»
            $value = ~%row{$field};
        }
        return True if $value.starts-with($prefix, :ignorecase) && $value ~~ $pattern;
    }
    return False;
}

sub default-head-value(Int:D $indx, Str:D $field, Bool:D $colour, Bool:D $syntax, Str:D @fields --> Str:D) {
    if $colour {
        if $syntax { #`««« no real syntax Highlighting here this
                           is a generic function write your own. »»»
            return t.color(0, 255, 255) ~ $field;
        } else {
            return t.color(0, 255, 255) ~ $field;
        }
    } else {
        return $field;
    }
}

sub default-field-value(Int:D $idx, Str:D $field, $value, Bool:D $colour, Bool:D $syntax, Str:D @fields, %row --> Str:D) {
    my Str:D $val = ~($value // ''); #`««« assumming $value is a Str:D; if
                                           this asumption is false you will
                                           need to wrte your own function
                                           to pass to list-by(…) »»»
    if $colour {
        if $syntax { #`««« no real syntax Highlighting here this
                           is a generic function write your own. »»»
            return t.color(0, 0, 255) ~ $val;
        } else {
            return t.color(0, 0, 255) ~ $val;
        }
    } else {
        return $val;
    }
}

sub default-head-between(Int:D $idx, Str:D $field, Bool:D $colour, Bool:D $syntax, Str:D @fields --> Str:D) is export {
    if $idx < @fields.elems {
        return '  ';
    } else {
        return '';
    }
}

sub default-between(Int:D $idx, Str:D $field, Bool:D $colour, Bool:D $syntax, Str:D @fields, %row --> Str:D) is export {
    if $idx < @fields.elems {
        return '  ';
    } else {
        return '';
    }
}

sub default-row-formatting(Int:D $cnt, Bool:D $colour, Bool:D $syntax --> Str:D) is export {
    if $colour {
        if $syntax { #`««« no real syntax Highlighting here this
                           is a generic function write your own. »»»
            return t.bg-color(255, 0, 255) ~ t.bold ~ t.bright-blue if $cnt == -3; # three heading lines. #
            return t.bg-color(0, 255, 255) ~ t.bold ~ t.bright-blue if $cnt == -2;
            return t.bg-color(255, 0, 255) ~ t.bold ~ t.bright-blue if $cnt == -1;
            return (($cnt % 2 == 0) ?? t.bg-yellow !! t.bg-color(0,255,0)) ~ t.bold ~ t.bright-blue;
        } else {
            return t.bg-color(255, 0, 255) ~ t.bold ~ t.bright-blue if $cnt == -3;
            return t.bg-color(0, 255, 255) ~ t.bold ~ t.bright-blue if $cnt == -2;
            return t.bg-color(255, 0, 255) ~ t.bold ~ t.bright-blue if $cnt == -1;
            return (($cnt % 2 == 0) ?? t.bg-yellow !! t.bg-color(0,255,0)) ~ t.bold ~ t.bright-blue;
        }
    } else {
        return '';
    }
}

multi sub default-zip-flags(Str:D $key-name, Str:D @fields --> Hash[Str:D] ) is export {
    my Str:D %hash = @fields Z=> @fields.map: { '-' };
    %hash{$key-name} = '-';
    return %hash;
}

```

### The array of hashes stuff

```
sub default-include-row-array(Str:D $prefix, Regex:D $pattern, Int:D $indx, Str:D @fields, %row --> Bool:D) is export {
    for @fields -> $field {
        my Str:D $value = ~(%row{$field} // '');
        return True if $value.starts-with($prefix, :ignorecase) && $value ~~ $pattern;
    }
    return False;
}

sub default-head-value-array(Int:D $indx, Str:D $field, Bool:D $colour, Bool:D $syntax, Str:D @fields --> Str:D) {
    if $colour {
        if $syntax { #`««« no real syntax Highlighting here this
                           is a generic function write your own. »»»
            return t.color(0, 255, 255) ~ $field;
        } else {
            return t.color(0, 255, 255) ~ $field;
        }
    } else {
        return $field;
    }
}

sub default-field-value-array(Int:D $idx, Str:D $field, $value, Bool:D $colour, Bool:D $syntax, Str:D @fields, %row --> Str:D) {
    my Str:D $val = ~($value // ''); #`««« assumming $value is a Str:D; if
                                           this asumption is false you will
                                           need to wrte your own function
                                           to pass to list-by(…) »»»
    if $colour {
        if $syntax { #`««« no real syntax Highlighting here this
                           is a generic function write your own. »»»
            return t.color(0, 0, 255) ~ $val;
        } else {
            return t.color(0, 0, 255) ~ $val;
        }
    } else {
        return $val;
    }
}

sub default-head-between-array(Int:D $idx, Str:D $field, Bool:D $colour, Bool:D $syntax, Str:D @fields --> Str:D)


## dist_zef-grizzlysmit-Display-Listings.md
## Chunk 2 of 2
 is export {
    if $idx < @fields.elems {
        return '  ';
    } else {
        return '';
    }
}

sub default-between-array(Int:D $idx, Str:D $field, Bool:D $colour, Bool:D $syntax, Str:D @fields, %row --> Str:D) is export {
    if $idx < @fields.elems {
        return '  ';
    } else {
        return '';
    }
}

sub default-row-formatting-array(Int:D $cnt, Bool:D $colour, Bool:D $syntax --> Str:D) is export {
    if $colour {
        if $syntax { #`««« no real syntax Highlighting here this
                           is a generic function write your own. »»»
            return t.bg-color(255, 0, 255) ~ t.bold ~ t.bright-blue if $cnt == -3; # three heading lines. #
            return t.bg-color(0, 255, 255) ~ t.bold ~ t.bright-blue if $cnt == -2;
            return t.bg-color(255, 0, 255) ~ t.bold ~ t.bright-blue if $cnt == -1;
            return (($cnt % 2 == 0) ?? t.bg-yellow !! t.bg-color(0,255,0)) ~ t.bold ~ t.bright-blue;
        } else {
            return t.bg-color(255, 0, 255) ~ t.bold ~ t.bright-blue if $cnt == -3;
            return t.bg-color(0, 255, 255) ~ t.bold ~ t.bright-blue if $cnt == -2;
            return t.bg-color(255, 0, 255) ~ t.bold ~ t.bright-blue if $cnt == -1;
            return (($cnt % 2 == 0) ?? t.bg-yellow !! t.bg-color(0,255,0)) ~ t.bold ~ t.bright-blue;
        }
    } else {
        return '';
    }
}

multi sub default-zip-flags(Str:D @fields --> Hash[Str:D] ) is export {
    my Str:D %hash = @fields Z=> @fields.map: { '-' };
    return %hash;
}

```


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

# NAME

Resend - Raku SDK for Resend

# SYNOPSIS

```
use Resend;

my $resend = Resend.new("YOUR_API_KEY");

say $resend.domains.list;

```

# DESCRIPTION

Raku SDK for Resend

# AUTHOR

khalidelborai [elboraikhalid@gmail.com](mailto:elboraikhalid@gmail.com)

# COPYRIGHT AND LICENSE

Copyright 2023 khalidelborai

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


## para.md
class Pod::Block::Para

Paragraph in a Pod document

```raku
class Pod::Block::Para is Pod::Block { }
```

Class for a Pod paragraph.


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

# Math-PascalTriangle

Simple Pascal's Triangle module


## os.md
role X::OS

Error reported by the operating system

```raku
role X::OS { has $.os-error }
```

Common role for all exceptions that are triggered by some error reported by the operating system (failed IO, system calls, fork, memory allocation).

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

## [method os-error](#role_X::OS "go to top of document")[§](#method_os-error "direct link")

```raku
method os-error(--> Str:D)
```

Returns the error as reported by the operating system.


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

# NAME

DateTime::strftime - provide strftime() formatting for DateTime objects

# SYNOPSIS

```
use DateTime::strftime;

say strftime(DateTime.now, '%c');  # default": EN
# Sun Jan 19 13:19:02 +0100 2025

say strftime(DateTime.now, '%c', "NL");
# zon 19 jan 13:19:02 +0100 2025

```

# DESCRIPTION

The `DateTime::strftime` distribution provides a `strftime` subroutine that takes a `DateTime` object, a [`strftime`](https://linux.die.net/man/3/strftime) format string (or its `:text:` equivalent), and an optional locale indicator (which defaults to the dynamic variable `$*LOCALE-DATES` or `"EN"`).

It returns the representation of the `DateTime` object according to that format and locale.

# FORMAT SPECIFICATION

The supported formats are a (large) subset of `strftime`. The `E` and `O` modifiers are **not** supported.

Since the `strftime` format codes are rather cryptic (although very widely in use), one can also use an alternate `:text:` format. So instead of the rather cryptic `"%c"`, one can also use `":datetime:"`.

| Code | :text: | Value |
| --- | --- | --- |
| %a | wkdname | abbreviated weekday name |
| %A | weekdayname | full weekday name |
| %b | mnthname | abbreviated month name |
| %B | monthname | full month name |
| %c | datetime | preferred date/time representation |
| %C | century | century number (year div 100) |
| %d | 0day | day of month ("01" .. "31") |
| %D | usadate | short for: %m/%d/%y |
| %e | day | day of month (" 1" .. "31") |
| %f |  | same as %M |
| %F | isodate | short for: %Y/%m/%d |
| %g | weekYY | YY of this week ("00" .. "99") |
| %G | weekYYYY | full year of this week |
| %h |  | same as %b |
| %H | 0hour | 24-hour hour ("00" .. "23") |
| %I | 0amhour | 12-hour hour ("01" .. "12") |
| %j | yearday | day of the year ("001" .. "366") |
| %k | hour | 24-hour hour (" 1" .. "23") |
| %l | amhour | 12-hour hour (" 1" .. "12") |
| %L |  | same as %Y |
| %m | month | month ("01" .. "12") |
| %M | minute | minute ("00" .. "59") |
| %n | newline | "\n" |
| %p | AMPM | "AM" | "PM" |
| %P | ampm | "am" | "pm" |
| %r | amtime | short for: %I:%M:%S %p |
| %R | HHMM | short for: %H:%M |
| %s | epoch | seconds since epoch (midnight 1970-01-01 UTC) |
| %S | second | second ("00" .. "59") |
| %t | tab | "\t" |
| %T | HHMMSS | short for: %H:%M:%S |
| %u | weekday | weekday (1 .. 7) |
| %U | weekSun | week number (first Sunday) ("00" .. "53") |
| %v | DD-MON-YYYY | short for: %e-%b-%Y |
| %V | weekISO | week number (ISO 8601) ("00" .. "53") |
| %w | 0weekday | weekday (0 .. 6) |
| %W | weekMon | week number (first Monday) ("00" .. "53") |
| %x | date | preferred date representation |
| %X | time | preferred time representation |
| %y | YY | year without century ("00" .. "99") |
| %Y | year | year (yyyy) |
| %z | tzoffset | numeric timezone (±HHMM) |
| %Z | timezone | timezone (no name: %z) |
| %+ | unixdate | short for: %a %b %e %T %Z %Y |
| %% | percent | "%" |

Please note that one probably shouldn't use the `%g` and `%y` formats for anything that is persistent. Data and programs stay around longer then anybody expects, and we don't want another [Y2K](https://en.wikipedia.org/wiki/Year_2000_problem) problem, especially in a 100-year programming language!

# DEFAULT LOCALIZATION

```
my $*LOCALE-DATES = "NL";
say strftime($dt, ':weekdayname:');        # zondag
say strftime($dt, ':weekdayname:', "EN");  # Sunday

```

The `$*LOCALE-DATES` dynamic variable can be set with the string of the desired localization, or with an instantiated `Locale::Dates` object. It will then affect any call to `strftime` that does **not** have an explicit localization specified.

# LEXICAL REFINEMENT

```
use DateTime::strftime :refine;

say DateTime.now.strftime('%c');  # default": EN
# Sun Jan 19 13:19:02 +0100 2025

say DateTime.now.strftime(':datetime:', "NL");
# zon 19 jan 13:19:02 +0100 2025

```

You can also use `DateTime::strftime` with the `:refine` parameter. This will add a `strftime` method to the `DateTime` class in the lexical scope in which the `use` statement is located. This allows one to not to have to change existing code using the `DateTime` class, while still having the added functionality of a `DateTime.strftime` method.

# OTHER SOFTWARE

See also Jean Forget's [`Date::Calendar::Strftime`](https://raku.land/zef:jforget/Date::Calendar::Strftime) and [`Date::Calendar::Gregorian`](https://raku.land/zef:jforget/Date::Calendar::Gregorian).

# AUTHOR

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

Source can be located at: <https://github.com/lizmat/DateTime-strftime> . 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_github-ppentchev-Test-Deeply-Relaxed.md
# NAME

Test::Deeply::Relaxed - Compare two complex data structures loosely

# SYNOPSIS

```
    use Test;
    use Test::Deeply::Relaxed;

    is-deeply-relaxed 'foo', 'foo';
    isnt-deeply-relaxed 'foo', 'bar';

    is-deeply-relaxed 5, 5;
    isnt-deeply-relaxed 5, '5';

    is-deeply-relaxed [1, 2, 3], Array[Int:D].new(1, 2, 3);

    is-deeply-relaxed {:a("foo"), :b("bar")}, Hash[Str:D].new({ :a("foo"), :b("bar") });

    # And now for the one that made me write this...
    my Array[Str:D] %opts;
    %opts<v> = Array[Str:D].new("v", "v");
    %opts<i> = Array[Str:D].new("foo.txt", "bar.txt");
    is-deeply-relaxed %opts, {:v([<v v>]), :i([<foo.txt bar.txt>]) };

    # It works with weirder types, too
    is-deeply-relaxed bag(<a b a a>), { a => 3, b => 1 }.Mix;
    isnt-deeply-relaxed bag(<a b a a>), { a => 2, b => 1 }.Mix;
    isnt-deeply-relaxed bag(<a b a a>), { a => 3, b => 1.5 }.Mix;

```

# DESCRIPTION

The `Test:::Deeply::Relaxed` module provides the `is-deeply-relaxed()` and `isnt-deeply-relaxed()` functions that do not check the state of mind of the passed objects, but instead compare their structure in depth similarly to `is-deeply()`, but a bit more loosely. In particular, they ignore the differences between typed and untyped collections, e.g. they will consider an array and an explicit `Array[Str:D]` to be the same if the strings contained within are indeed the same.

# FUNCTIONS

* sub is-deeply-relaxed

  ```
  sub is-deeply-relaxed($got, $expected, $name = Str, Bool:D :$cache = False)

  ```

  Compare the two data structures in depth similarly to `is-deeply()`, but a bit more loosely.

  If the `:cache` flag is specified, the cache of values will be used for any iterable objects that support it. This allows the caller to later examine the sequences further.

  Current API available since version 0.1.0.
* sub isnt-deeply-relaxed

  ```
  sub isnt-deeply-relaxed($got, $expected, $name = Str, Bool:D :$cache = False)

  ```

  The opposite of `is-deeply-relaxed()` - fail if the two structures are loosely the same.

  Current API available since version 0.1.0.

# AUTHOR

Peter Pentchev <[roam@ringlet.net](mailto:roam@ringlet.net)>

# COPYRIGHT

Copyright (C) 2016, 2017 Peter Pentchev

# LICENSE

The Test::Deeply::Relaxed module is distributed under the terms of the Artistic License 2.0. For more details, see the full text of the license in the file LICENSE in the source distribution.


## dist_zef-rawleyfowler-Humming-Bird-Core.md
# Humming-Bird

![Zef Badge](https://raku.land/zef:rawleyfowler/Humming-Bird/badges/version?)
[![SparrowCI](https://ci.sparrowhub.io/project/gh-rawleyfowler-Humming-Bird/badge)](https://ci.sparrowhub.io)

**Here be dragons**: Humming-Bird is still young, you may run into bugs, creatures, and daemons, if you run into any issues, please make an [issue](https://github.com/rawleyfowler/Humming-Bird/issues)!

Humming-Bird is a simple, composable, and performant, all in one HTTP web-framework for Raku.
Humming-Bird was inspired mainly by [Opium](https://github.com/rgrinberg/opium), [Sinatra](https://sinatrarb.com), and [Express](https://expressjs.com), and tries to keep
things minimal, allowing the user to pull in things like templating engines, and ORM's on their own terms.

Humming-Bird comes with what you need to quickly, and efficiently spin up REST API's, and with a few of the users favorite libraries, dynamic MVC style web-apps.

Humming-Bird is not meant to face the internet directly. Please use a reverse proxy such as httpd or NGiNX.

## Examples

#### Simple example:

```
use v6.d;

use Humming-Bird::Core;

get('/', -> $request, $response {
    $response.html('<h1>Hello World</h1>');
});

listen(8080);

# Navigate to localhost:8080!

```

#### Simple JSON example:

```
use v6;

use Humming-Bird::Core;

my %users = Map.new('bob', '{ "name": "bob" }', 'joe', '{ "name": "joe" }');

get('/users/:user', -> $request, $response {
    my $user = $request.param('user');

    if %users{$user}:exists {
        $response.json(%users{$user});
    } else {
        $response.status(404);
    }
});

listen(8080);

```

#### Middleware

```
use v6.d;

use Humming-Bird::Core;
use Humming-Bird::Middleware;

get('/logged', -> $request, $response {
    $response.html('This request has been logged!');
}, [ &middleware-logger ]); # &middleware-logger is provided by Humming-Bird::Middleware

# Custom middleware
sub block-firefox($request, $response, &next) {
    return $response.status(400) if $request.header('User-Agent').starts-with('Mozilla');
    $response.status(200);
}

get('/no-firefox', -> $request, $response {
    $response.html('You are not using Firefox!');
}, [ &middleware-logger, &block-firefox ]);

# Scoped middleware

# Both of these routes will now share the middleware specified in the last parameter of the group.
group([
    &get.assuming('/', -> $request, $response {
        $response.write('Index');
    }),

    &post.assuming('/users', -> $request, $response {
        $response.write($request.body).status(204);
    })
], [ &middleware-logger, &block-firefox ]);

```

More examples can be found in the [examples](https://github.com/rawleyfowler/Humming-Bird/tree/main/examples) directory.

## Design

* Humming-Bird should be easy to pickup, and simple for developers new to Raku and/or web development.
* Humming-Bird is not designed to be exposed to the internet directly. You should hide Humming-Bird behind a reverse-proxy like NGiNX or httpd.
* Simple and composable via middlewares.

## Things to keep in mind

* This project is in active development, things will break.
* You may run into bugs.
* **Not** production ready, yet.

## How to install

Make sure you have [zef](https://github.com/ugexe/zef) installed.

#### Install latest

```
zef -v install https://github.com/rawleyfowler/Humming-Bird.git

```

#### Install stable

```
zef install Humming-Bird

```

## Contributing

All contributions are encouraged! I know the Raku community is amazing, so I hope to see
some people get involved :D

Please make sure you squash your branch, and name it accordingly before it gets merged!

## License

Humming-Bird is available under the MIT, you can view the license in the `LICENSE` file
at the root of the project. For more information about the MIT, please click
[here](https://mit-license.org/).


## dist_zef-finanalyst-Collection-Raku-Documentation.md
# Collection-based Raku Documentation

> **Description** Distribution to set up Raku Documentation website.

> **Author** Richard Hainsworth, aka finanalyst

---

## Table of Contents

[Installation](#installation)
[Raku-Doc](#raku-doc)
[Raku-Doc as a wrapper for Collection::collect](#raku-doc-as-a-wrapper-for-collectioncollect)
[More contemporary web site.](#more-contemporary-web-site)
[In the future (not now)](#in-the-future-not-now)
[Enabling Cro App](#enabling-cro-app)
[Highlighting](#highlighting)
[Problems](#problems)
[Copyright and License](#copyright-and-license)

---

This Module creates a local website of the Raku documentation. It pulls together information held in several other distributions. The main content of this distribution is the `Raku-Doc` utility. It is intended to be as simple as possible. But the documentation system is large. The following contain other requirements.

* The documentation files are held in a github repository that is maintained and updated by the Raku community. `Raku-Doc` needs to have a local clone of the repository. It can be used to refresh the documents automatically.
* `Raku-Doc` uses Collection and Raku::Pod::Render to link all the Rakudoc (aka Pod6) files together. So `Collection` needs to be installed, which will install `Raku::Pod::Render`. By installing `Raku-Pod-Render` a user can then use `Pod::To::HTML2` to render individual `.rakudoc / .pod6` files into HTML, or `Pod::To::MarkDown2` to render them into `.md` files.
* `Collection` requires over a dozen plugins, which are automatically refreshed from a github repository by `Raku-Doc`.
* The Raku documentation system can currently be visualised in two ways:

  * using the original web design started by Moritz Lenz (using the mode Website) - currently the default.
  * using a new design by OgdenWebb (using the mode OgdenWebb).
* The website is intended to be served locally with a Cro app. Since making Cro a dependency can cause problems in a testing environment, the META6.json does not have Cro as a dependency. If Cro::HTTP is not installed, the completion plugin will exit with a note.
* A website contains templates and structure documents, which describe the website into which the Raku documentation fit. This content is also held in a separate repository. This is intended to keep the development of plugins separate from the structure documents and templates, and separate from the Raku documentation content.

# Installation

```
zef install Collection-Raku-Documentation

```

This installs the `Collection` (and other) dependencies and the `Raku-Doc` executable. These in turn install the the other main distributions and `Raku::Pod::Render`. By default `Raku::Pod::Render` does not install the highlighter automatically because `node.js` and `npm` are required.

See [Highlighting](Highlighting.md) for installation of highlighter.

# Raku-Doc

On a Linux based distributions, `Raku-Doc` depends on `git` and `unzip`, which typically are installed by default, to get and unpack other files.

Under Linux, in a terminal, the following will lead to the installation of a local copy of Raku docs and start a Cro app that will make the HTML documentation available in a browser at `localhost:30000`, and produce a progress status bar for the longer stages.

```
mkdir ~/raku-collection
cd raku-collection
Raku-Doc Init

```

This sets up a Collection directory by downloading the Website mode from github, then installs the Collection plugins.

By default the `Raku/doc` repository (containing all the Raku documentation files) will be created in the next step as **local\_raku\_docs**.

If a user wants to clone the Raku docs repository elsewhere or has an existing clone of the Raku repository, then the non-default path needs to be put into the config.raku file in the `sources-obtain` and `sources-refresh` keys. See the documentation for the `Collection` distribution for more information.

At the next invocation of **Raku-Doc**, the documentation source will be cloned, cached, and rendered.

For example, to render the full Raku Docs, the following would work, where `raku-local` is a local directory.

```
- raku-collection
    - local_raku_docs # this is generated by the git clone command
    - Website # this is generated by runnng 'Raku-Doc Init' in raku-collection
    config.raku # as Website

```

After the `Init` stage, calling `Raku-Doc` without any other options implies the mode **Website** with default options.

The Raku Documentation source files are regularly updated. The **Website** mode is configured to pull the latest versions of the source files into the Collection whenever `Raku-Doc` is run, which then updates the cache for any sources that have changed, and then re-render all the html files that are affected. These stages are automatically called by running Raku-Doc with the config defaults given.

The Website mode files and plugins are being actively developed, so newer versions may be available. New versions of the plugins are automatically called on each invocation of Raku-Doc. To get new versions of the Website mode files (sources and additional plugins), use

```
Raku-Doc Update

```

`Raku-Doc` can be called with other options, which are described in the `Collection` documentation.

**Collection-Raku-Documentation** is set up with the default `mode` called **Website**.

The more contemporary web design by Ogden Webb is in a mode call **OgdenWebb**. It is generated thus:

```
Raku-Doc OgdenWebb

```

It can be made the default by changing the `mode` key in the top-level `config.raku` file.

# Raku-Doc as a wrapper for Collection::collect

With the exception of 'Init' and 'Update', `Raku-Doc` can be called with all the options listed for `Collection::collect`.

More information about these options is given in the Documentation for `Collection`.

## More contemporary web site.

A more contemporary web design by Ogden Webb is now included. It is generated by running

```
Raku-Doc OgdenWebb

```

## In the future (not now)

If `Raku-Doc` is called with a string other than 'Init' or 'Website', then the string is interpreted as another **Mode**, with its own sub-directory and [Configuration](Configuration.md) for the collection. For example,

```
Raku-Doc Book

```

would create the collection output defined by the configuration in the sub-directory `Book/config/`. This design is to allow for the creation of different Collection outputs to be defined for the same content files.

# Enabling Cro App

A Cro App is included that will run the website automatically by running `Raku-Doc`. The Cro App is called using a plugin that runs after the html files have been refreshed. The Cro App is called at completion (see Collection documentation). It contains a test to see if Cro::HTTP is installed.

Since installing Cro can cause testing problems, this distribution does not have Cro::HTTP as a dependency.

Cro in installed using zef as

```
zef install Cro::HTTP

```

Running `Raku-Doc` without options will now serve the documentation files locally on port 3000. So point your browser at `localhost:3000`

# Highlighting

The default highlighter at present is a Node based toolstack called **atom-perl-highlighter**. In order to install it automatically, `Raku::Pod::Render` requires an uptodate version of npm. The builder is known not to work with `node.js` > \*\*\*\*v13.0> and `npm` > **v14.15**.

For someone who has not installed `node` or `npm` before, or for whom they are only needed for the highlighter, the installation is ... confusing. It would seem at the time of writing that the easiest method is:

```
# Using Ubuntu
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs

```

Then, **after the default installation of Raku::Pod::Render**, highlighting can be enabled by running the following in a terminal:

```
raku-render-install-highlighter

```

# Problems

Collection is still being actively developed.

* When running `Raku-Doc` with a `sources-refresh` key set to a git pull stanza, Raku-Doc teminates after a git pull. Workaround: run `Raku-Doc` again.

# Copyright and License

(c) Richard N Hainsworth, 2021-2022

**LICENSE** Artistic-2.0

---

Rendered from README at 2023-01-14T10:19:05Z


## dist_zef-khalidelborai-SOD.md
# TITLE

SOD

# SUBTITLE

Raku bindings for the SOD image processing library

# DESCRIPTION

SOD is an embedded, modern cross-platform computer vision and machine learning software library that exposes a set of APIs for deep-learning, advanced media analysis & processing including real-time, multi-class object detection and model training on embedded systems with limited computational resource and IoT devices.

# CLASSES

## Image

An `Image` class representing an image that can be manipulated.

### Attributes

* * CImage $.cimage - underlying CImage structure

### Class Methods

* *load*

  `load(Str $filename, Int :$channels = 3 --> Image)`

  Load an image from file with a specified number of channels
* *load\_gray*

  `load_gray(Str $filename --> Image)`

  Load an image from file in grayscale (single channel)
* *empty*

  `empty(:w($width), :h($height), :c($channels) = 3 --> Image)`

  Create an empty image with given dimensions and number of channels
* *zeros*

  `zeros(:w($width), :h($height), :c($channels) = 3 --> Image)`

  Create an image filled with zeros with given dimensions and number of channels
* *random*

  `random(:w($width), :h($height), :c($channels) = 3 --> Image)`

  Create a random image with given dimensions and number of channels

### Instance Methods

* *copy*

  `copy(--> Image)`

  Copy the current image
* *clone*

  `clone(--> Image)`

  Clone the current image (alias for copy)
* *save\_png*

  `save_png(Str $filename --> uint8)`

  Save the current image as a PNG file
* *save\_jpeg*

  `save_jpeg(Str $filename, Int() $quality --> uint8)`

  Save the current image as a JPEG file with specified quality
* *save\_bmp*

  `save_bmp(Str $filename --> uint8)`

  Save the current image as a BMP file
* *set\_pixel*

  `set_pixel($x, $y, $c, Num() $v)`

  Set the pixel value at the specified coordinates and channel
* *get\_pixel*

  `get_pixel($x, $y, $c)`

  Get the pixel value at the specified coordinates and channel
* *resize*

  `resize(Int() $w, Int() $h --> Image)`

  Resize the current image to the specified dimensions
* *resize\_max*

  `resize_max(Int() $max --> Image)`

  Resize the current image such that the maximum dimension is equal to $max
* *resize\_min*

  `resize_min(Int() $min --> Image)`

  Resize the current image such that the minimum dimension is equal to $min
* *rotate\_crop*

  `rotate_crop(Num() :a($angle), Scale() :s($scale), Int() :w($width), Int() :h($height), Int() :x($dx), Int() :y($dy), Num() :as($aspect) --> Image)`

  Rotate and crop the current image
* *translate*

  `translate(Scale() $scale --> Image)`

  Translate the current image by the specified scale
* *scale*

  `scale(Scale() $scale --> Image)`

  Scale the current image by the specified scale
* *normalize*

  `normalize(--> Image)`

  Normalize the current image
* *transpose*

  `transpose(--> Image)`

  Transpose the current image
* *rotate*

  `rotate(Num() $angle --> Image)`

  Rotate the current image by the specified angle
* *box*

  `box(Int() $x1, Int() $y1, Int() $x2, Int() $y2, Num() $r, Num() $g, Num() $b --> Image)`

  Draw a box on the current image with specified coordinates and color
* *bbox*

  `bbox(Box $box, Num() $r, Num() $g, Num() $b --> Image)`

  `bbox(Box $box, Num() $r, Num() $g, Num() $b, Int() $width --> Image)`

  Draw a bounding box on the current image with specified box, color, and optional width
* *box\_grayscale*

  `box_grayscale(Int() $x1, Int() $y1, Int() $x2, Int() $y2, Num() $v --> Image)`

  Draw a box on the current image with specified coordinates and grayscale value
* *circle*

  `circle(Int() $x, Int() $y, Int() $r, Num() $red, Num() $green, Num() $blue --> Image)`

  `circle(Int() $x, Int() $y, Int() $radius,Int() $thickness, Num() $r, Num() $g,Num() $b, --> Image)`

  Draw a circle on the current image with specified coordinates, radius, color, and optional thickness.
* *crop*

  `crop(Int() $x, Int() $y, Int() $w, Int() $h --> Image)`

  Crop the current image with specified coordinates and dimensions
* *random\_crop*

  `random_crop(Int() $w, Int() $h --> Image)`

  Randomly crop the current image with specified dimensions
* *random\_augment*

  `random_augment(Num() $angel, Num() $aspect, Int() $low, Int() $high, Int() $size --> Image)`

  Randomly augment the current image with specified parameters.
* *add\_pixel*

  `add_pixel(Int() $x, Int() $y, Int() $c, Num() $v --> Image)`

  Add a constant value to a pixel at the given location. This value must be set between 0..1 such as 0.7.
* *rgb\_to\_bgr*

  `rgb_to_bgr(--> Image)`

  Change the RGB colorspace of a given image to the BGR colorspace.
* *bgr\_to\_rgb*

  `bgr_to_rgb(--> Image)`

  Change the BGR colorspace of a given image to the RGB colorspace.
* *rgb\_to\_hsv*

  `rgb_to_hsv(--> Image)`

  Change the RGB colorspace of a given image to the HSV colorspace.
* *hsv\_to\_rgb*

  `hsv_to_rgb(--> Image)`

  Change the HSV colorspace of a given image to the RGB colorspace.
* *yuv\_to\_rgb*

  `yuv_to_rgb(--> Image)`

  Change the YUV colorspace of a given image to the RGB colorspace.
* *rgb\_to\_yuv*

  `rgb_to_yuv(--> Image)`

  Change the RGB colorspace of a given image to the YUV colorspace.

# AUTHOR

Khalid Elborai [elboraikhalid@gmail.com](mailto:elboraikhalid@gmail.com)


## dist_github-cosimo-Cache-Memcached.md
# Cache::Memcached [Build Status](https://travis-ci.org/cosimo/perl6-cache-memcached)

Perl6 client for [memcached](http://www.danga.com/memcached/) a distributed
caching daemon.

## Synopsis

```
  use Cache::Memcached;

  my $memd = Cache::Memcached.new;

  $memd.set("my_key", "Some value");

  $memd.incr("key");
  $memd.decr("key");
  $memd.incr("key", 2);

```

Or you can use it as an Associative type:

```

use Cache::Memcached;

my $memd = Cache::Memcached.new;

$memd<my_key> = "Some value";
say $memd<my_key>;
$memd<my_key>:delete;

```

## Description

This provides an interface to the [memcached](http://www.danga.com/memcached/)
daemon. You will need to have access to a memcached server to be able to
use it.

Currently there is no support for compression or the serialization of
structured objects (though both could be provided by the agency of
external modules.)

## Installation

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

```
# From the source directory

zef install .

# Remote installation

zef install Cache::Memcached

```

There should be no reason that it won't work with any new installer
that may come along in the future.

## Support

Suggestions/patches are welcomed via github at

<https://github.com/cosimo/perl6-cache-memcached/issues>


## dist_github-jaffa4-Path-Util.md
# pathutil

Path::Util

Break up a file path into its components.

Usage:

use Path::Util;

my $p = Path::Util.new("d:\docs\usage.txt");
It can break-up Unix like or Dos like file paths.

say $p.getdrive; or say $p.drive; # it gets the drive letter, for Windwos only. Otherwise, it returns "".
say $p.getdir; or say $p.directory; or say $p.dir
say $p.getext; or say $p.extension
say $p.getbasename; # returns the filename without directory
say $p.getjustname; # returns the filename without directory and extension

Above also work without get.

say $p.print; # prints all components

say $p.separator; # returns the separator found in the path, it can be "" or "/" or "".

say $p.fsseparator; # returns Windows or Unix-like file separator depending where you run your script

say $p.getnumberofdirlevel; # number of levels in the directory

say $p.getdirlevel(2); # returns directory up to the second level

say $p.tocygwin(); # returns the cygwin format of a Windows path, nothing happens if it is of other kind.
e.g. /cygdrive/d/music/after.mp4

say $p.tomsys(); # returns the msysformat of a Windows path, nothing happens if it is of other kind.
e.g. /d/music/after.mp4

Also, it is possible to use them non-object oriented way.

say Path::Util.getbasename("d:\docs\usage.txt");

Extension is returned without dot.
Directories are returned without ending separator.


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

# NAME

Acme::Overreact - Make your code overreact

# SYNOPSIS

```
use Acme::Overreact;

CHECK overreact;

say 42; # prints '42!!!'

```

# DESCRIPTION

Acme::Overreact is just a joke, please do not use that in production code

# AUTHOR

Fernando Corrêa de Oliveira [fernando.correa@humanstate.com](mailto:fernando.correa@humanstate.com)

# COPYRIGHT AND LICENSE

Copyright 2024 Fernando Corrêa de Oliveira

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


## dist_zef-elcaro-Exportable.md
# NAME

Exportable - Simple function exporting

# SYNOPSIS

Import in module code, and apply trait to exportable subs. Tags work normally

```
use Exportable;

module Foo {
    our sub foo is exportable { ... }
    our sub bar is exportable(:b) { ... }
    our sub baz is exportable(:b) { ... }
    our sub qux { ... }
}

```

Module users can now import subs by name...

```
use Foo <foo bar baz>;

```

or with tags...

```
use Foo :b;  # 'foo' not imported

```

# DESCRIPTION

`Exportable` makes it simple to explicitly declare exportable functions from your module.

There's already an `export` sub trait, but it pollute the users namespace. The `exportable` trait is almost identical, except it does not export by default.

There's no need to write the function name a second time, and/or write your own complicated `EXPORT` sub.

This module is fairly sparse in what it does on purpose, but if you think there is a glaring omission, raise an issue.

# CAVEATS

Due to how this module works, it must be imported outside the module scope. Typically this is done either above a `Module` block (as shown in the SYNOPSIS), or above a unit scoped module.

```
use Exportable;
unit module Foo;
our sub foo is exportable { ... }
our sub bar is exportable(:b) { ... }

```

On a side note, declaring public facing subs as `our` scoped is a courtesy to users who may not wish to import any functions, and instead use the fully-qualified name, eg. `Foo::bar()`.

# ADDENDUM

This module was written after a wrote a [blog post](https://0racle.info/articles/exportation_exploration) talking about the function exporting in Raku. Special thanks goes to [FCO](https://github.com/FCO), who helped by figuring out most the core in this module.


## dist_github-Skarsnik-Linux-Proc-Statm.md
# Name Linux::Proc::Statm

# Usage

```
 use Linux::Proc::Statm;
 my %meminfo = get-statm(42); #get info for the pid 42
 say %meminfo<data>; # data + stack size
 say get-statm.perl; #use $*PID
 say get-statm-human<data>; # 54.552 kB

```

Values are given in Kb by default. You can change this behavior by passing a `:unit` named parameter with etheir b, k or m according to the unit you want.

```
say get-statm-human(:unit<m>)<data>; # 53 mB

```

# Author

Sylvain "Skarsnik" Colinet [scolinet@gmail.com](mailto:scolinet@gmail.com)


## dist_zef-jjmerelo-Algorithm-Evolutionary-Simple.md
[![Test-install and cache deps](https://github.com/JJ/p6-algorithm-evolutionary-simple/actions/workflows/test.yaml/badge.svg)](https://github.com/JJ/p6-algorithm-evolutionary-simple/actions/workflows/test.yaml)

# NAME

Algorithm::Evolutionary::Simple - A simple evolutionary algorithm

# SYNOPSIS

```
use Algorithm::Evolutionary::Simple;

# From resources/examples/max-ones.p6
my UInt :$length = 64;
my UInt :$population-size = 256;

my @initial-population = initialize( size => $population-size,
				     genome-length => $length );
my %fitness-of;

my $population = evaluate( population => @initial-population,
			   fitness-of => %fitness-of,
			   evaluator => &max-ones );

my $result = 0;
while $population.sort(*.value).reverse.[0].value < $length {
    $population = generation( population => $population,
			      fitness-of => %fitness-of,
			      evaluator => &max-ones,
			      population-size => $population-size) ;
    $result += $population-size;
    info(to-json( { best => best-fitness($population) } ));
}

say $result

```

# DESCRIPTION

`Algorithm::Evolutionary::Simple` is a module for writing simple and quasi
-canonical evolutionary algorithms in Raku. It uses binary representation,
integer fitness (which is needed for the kind of data structure we are using)
and a single fitness function.

It is intended mainly for demo purposes, although it's been actually used in
research. In the future, more versions will be available.

It uses a fitness cache for storing and not reevaluating already seen
chromosomes, so be mindful of memory bloat.

# EXAMPLES

Go to [`resources/examples`](resources/examples) for examples. For instance
, run `max-ones.p6` or `p-peaks.p6` there. You'll need to run

```
 zef  install --deps-only .

```

To install needed modules in that directory.

# METHODS

## initialize( UInt :$size, UInt :$genome-length --> Array ) is export

Creates the initial population of binary chromosomes with the indicated length; returns an array.

## random-chromosome( UInt $length --> List )

Generates a random chromosome of indicated length. Returns a `Seq` of `Bool`s

## max-ones( @chromosome --> Int )

Returns the number of trues (or ones) in the chromosome.

## leading-ones( @chromosome --> Int )

Returns the number of ones from the beginning of the chromosome.

## royal-road( @chromosome )

That's a bumpy road, returns 1 for each block of 4 which has the same true or false value.

## multi evaluate( :@population, :%fitness-of, :$evaluator, :$auto-t = False --> Mix ) is export

Evaluates the chromosomes, storing values in the fitness cache. If `auto-t` is set to 'True', uses autothreading for faster operation (if needed). In absence of that parameter, defaults to sequential.

## sub evaluate-nocache( :@population, :$evaluator --> Mix )

Evaluates the population, returning a Mix, but does not use a cache. Intended mainly for concurrent operation.

## get-pool-roulette-wheel( Mix $population, UInt $need = $population.elems ) is export

Returns `$need` elements with probability proportional to its *weight*, which is fitness in this case.

## mutation( @chromosome is copy --> Array )

Returns the chromosome with a random bit flipped.

## crossover ( @chromosome1 is copy, @chromosome2 is copy ) returns List

Returns two chromosomes, with parts of it crossed over. Generally you will want to do crossover first, then mutation.

## produce-offspring( @pool, $size = @pool.elems --> Seq ) is export

Produces offspring from an array that contains the reproductive pool; it returns a `Seq`.

## produce-offspring-no-mutation( @pool, $size = @pool.elems --> Seq ) is export

Produces offspring from an array that contains the reproductive pool without using mutation; it returns a `Seq`.

## best-fitness( $population )

Returns the fitness of the first element. Mainly useful to check if the algorithm is finished.

## multi sub generation( :@population, :%fitness-of, :$evaluator, :$population-size = $population.elems, Bool :$auto-t --> Mix )

Single generation of an evolutionary algorithm. The initial `Mix` has to be evaluated before entering here using the `evaluate` function. Will use auto-threading if `$auto-t` is `True`.

## multi sub generation( :@population, :%fitness-of, :$evaluator, :$population-size = $population.elems, Bool :$no-mutation --> Mix )

Single generation of an evolutionary algorithm. The initial `Mix` has to be evaluated before entering here using the `evaluate` function. Will not use mutation if that variable is set to `True`

## sub generations-without-change( $generations, $population )

Returns `False` if the number of generations in `$generations` has not been reached without changing; it returns `True` otherwise.

## mix( $population1, $population2, $size --> Mix ) is export

Mixes the two populations, returning a single one of the indicated size and with type Mix.

## sub pack-individual( @individual --> Int )

Packs the individual in a single `Int`. The invidual must be binary, and the maximum length is 64.

## sub unpack-individual( Int $packed, UInt $bits --> Array(Seq))

Unpacks the individual that has been packed previously using `pack-individual`

## sub pack-population( @population --> Buf)

Packs a population, producing a buffer which can be sent to a channel or stored in a compact form.

## sub unpack-population( Buf $buffer, UInt $bits --> Array )

Unpacks the population that has been packed using `pack-population`

## multi sub frequencies( $population)

`$population` can be an array or a Mix, in which case the keys are extracted. This returns the per-bit (or gene) frequency of one (or True) for the population.

## multi sub frequencies-best( $population, $proportion = 2)

`$population` is a Mix, in which case the keys are extracted. This returns the per-bit (or gene) frequency of one (or True) for the population of the best part of the population; the size of the population will be divided by the $proportion variable.

## sub generate-by-frequencies( $population-size, @frequencies )

Generates a population of that size with every gene according to the indicated frequency.

## sub crossover-frequencies( @frequencies, @frequencies-prime --> Array )

Generates a new array with random elements of the two arrays that are used as arguments.

# SEE ALSO

There is a very interesting implementation of an evolutionary algorithm in [Algorithm::Genetic](https://github.com/samgwise/p6-algorithm-genetic). Check it out.

This is also kind of a port of [Algorithm::Evolutionary::Simple to Perl6](https
://metacpan.org/release/Algorithm-Evolutionary-Simple), which has a few more goodies, but it's not simply a port, since most of the code is completely different.

# AUTHOR

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

# COPYRIGHT AND LICENSE

Copyright 2018, 2019, 2022 JJ Merelo

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


## dist_github-ramiroencinas-FileSystem-Capacity.md
# FileSystem::Capacity

[![Build Status](https://travis-ci.org/ramiroencinas/perl6-FileSystem-Capacity.svg?branch=master)](https://travis-ci.org/ramiroencinas/perl6-FileSystem-Capacity)

Provides filesystem capacity information.

Currently implements:

## Filesystem volumes size and free space:

* GNU/Linux by df command.
* Win32 by wmic command.
* OS X by df command.

## Size of given Directory:

* GNU/Linux by du command.
* Win32.

## Installing the module

```
zef update
zef install FileSystem::Capacity

```

## Example Usage:

```
use v6;
use FileSystem::Capacity::VolumesInfo;
use FileSystem::Capacity::DirSize;

say "Volumes Capacity Info:";
say "----------------------\n";

say "Byte version:\n";

my %vols = volumes-info();

for %vols.sort(*.key)>>.kv -> ($location, $data) {
  say "Location: $location";
  say "Size: $data<size> bytes";
  say "Used: $data<used> bytes";
  say "Used%: $data<used%>";
  say "Free: $data<free> bytes";
  say "---";
}

say "----";

say "Human version:\n";

my %vols-human = volumes-info(:human);

for %vols-human.sort(*.key)>>.kv -> ($location, $data) {
  say "Location: $location";
  say "Size: $data<size>";
  say "Used: $data<used>";
  say "Used%: $data<used%>";
  say "Free: $data<free>";
  say "---";
}

my $dir;

given $*KERNEL {
  when /linux/ { $dir = '/bin' }
  when /win32/ { $dir = 'c:\windows' }
}

say "\n\nDirectory Size of $dir:";
say "-----------------\n";

say " Byte version: " ~ dirsize($dir) ~ " bytes";
say "Human version: " ~ dirsize($dir, :human) ~ "\n";

```


## argfiles.md
class IO::ArgFiles

Iterate over contents of files specified on command line

```raku
class IO::ArgFiles is IO::CatHandle { }
```

This class exists for backwards compatibility reasons and provides no additional methods to [`IO::CatHandle`](/type/IO/CatHandle), so it can be used in the same way as it, for instance, in this way:

```raku
my $argfiles = IO::ArgFiles.new(@*ARGS);
.say for $argfiles.lines;

```

If invoked with `raku io-argfiles.raku *.raku` it will print the contents of all the files with that extension in the directory. However, that is totally equivalent to:

```raku
my $argfiles = IO::CatHandle.new(@*ARGS);
.say for $argfiles.lines;

```

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

## [`$*ARGFILES`](#class_IO::ArgFiles "go to top of document")[§](#$*ARGFILES "direct link")

This class is the magic behind the `$*ARGFILES` variable, which provides a way to iterate over files passed in to the program on the command line (i.e. elements of [`@*ARGS`](/language/variables#index-entry-%40%2AARGS)). Thus the examples above can be simplified like so:

```raku
.say for $*ARGFILES.lines;

# or
while ! $*ARGFILES.eof {
    say $*ARGFILES.get;
}

# or
say $*ARGFILES.slurp;
```

Save one of the variations above in a file, say `argfiles.raku`. Then create another file (named, say `sonnet18.txt` with the contents:

｢text｣ without highlighting

```

```

Shall I compare thee to a summer's day?

```

```

Running the command

｢text｣ without highlighting

```

```

$ raku argfiles.raku sonnet18.txt

```

```

will then give the output

｢text｣ without highlighting

```

```

Shall I compare thee to a summer's day?

```

```

As of 6.d language, `$*ARGFILES` *inside* [`sub MAIN`](/language/functions#sub_MAIN) is always set to `$*IN`, even when `@*ARGS` is not empty. That means that

```raku
sub MAIN () {
    .say for $*ARGFILES.lines;
}

```

which can be used as `cat *.raku | raku argfiles-main.raku`, for instance, is totally equivalent to:

```raku
sub MAIN () {
    .say for $*IN.lines;
}

```

and, in fact, can't be used to process the arguments in the command line, since, in this case, it would result in a usage error.

Bear in mind that the object `$*ARGFILES` is going to contain a handle for every argument in a command line, even if that argument is not a valid file. You can retrieve them via the `.handles` method.

```raku
for $*ARGFILES.handles -> $fh {
    say $fh;
}

```

That code will fail if any of the arguments is not the valid name of a file. You will have to deal with that case at another level, checking that [`@*ARGS`](/language/variables#index-entry-%40*ARGS) contains valid file names, for instance.


## dist_zef-jonathanstowe-JSON-Infer.md
# JSON::Infer

Create Raku classes to represent JSON data by some dodgy inference.

![Build Status](https://github.com/jonathanstowe/JSON-Infer/workflows/CI/badge.svg)

## Synopsis

Use the script to do it simply:

```
# Create the module in the directory "foo"

raku-json-infer --uri=http://api.mixcloud.com/spartacus/party-time/ --out-dir=foo --class-name=Mixcloud::Show

```

Or do it in your own code:

```

use JSON::Infer;

my $obj = JSON::Infer.new();
my $ret = $obj.infer(uri => 'http://api.mixcloud.com/spartacus/party-time/', class-name => 'Mixcloud::Show');

say $ret.make-class; # Print the class definition

```

## Description

JSON is nearly ubiquitous on the internet, developers love it for making
APIs. However the webservices that use it for transfer of data rarely
have a machine readable specification that can be turned into code so
developers who want to consume these services usually have to make the
client definition themselves.

This module aims to provide a way to generate Raku classes that can represent
the data from a JSON source. The structure and the types of the data is
inferred from a single data item so the accuracy may depend on the
consistency of the data.

## 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 JSON::Infer

```

Other install mechanisms may be become available in the future.

## Support

Suggestions/patches are welcomed via github at <https://github.com/jonathanstowe/JSON-Infer/issues>

## Licence

This is free software.

Please see the <LICENCE> file in the distribution for details.

© Jonathan Stowe 2015, 2016, 2017, 2019, 2020, 2021


## eq.md
eq

Combined from primary sources listed below.

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

See primary documentation
[in context](/language/operators#infix_eq)
for **infix eq**.

```raku
multi infix:<eq>(Any,   Any)
multi infix:<eq>(Str:D, Str:D)
```

String equality operator.

Coerces both arguments to [`Str`](/type/Str) (if necessary); returns `True` if both are equal.

Mnemonic: *equal*


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

# NAME

Raku port of Perl's Object::Trampoline module 1.50.4

# SYNOPSIS

```
# direct object creation
my $dbh = DBIish.connect( ... );
my $sth = $dbh.prepare( 'select foo from bar' );

if $need-to-execute {
    $sth.execute; # execute
}
else {
    say "database handle and statement executed without need";
}

# with delayed object creation
use Object::Trampoline;

my $dbh = Object::Trampoline.connect( DBIish, ... );
my $sth = Object::Trampoline.prepare( $dbh, 'select foo from bar' );

if $need-to-execute {
    $sth.execute; # create $dbh, then $sth, then execute
}
else {
    say "no database handle opened or statement executed";
}
LEAVE .disconnect with $dbh;  # only disconnects if connection was made

# alternate setup way, more idiomatic Raku
my $dbh = trampoline { DBIish.connect: ... }
my $sth = trampoline { $dbh.prepare: 'select foo from bar' }

# lazy default values for attributes in objects
class Foo {
    has $.bar = trampoline { say "delayed init"; "bar" }
}
my $foo = Foo.new;
say $foo.bar;  # delayed init; bar

```

# DESCRIPTION

This module tries to mimic the behaviour of Perl's `Object::Trampolinee` module as closely as possible in the Raku Programming Language.

There are times when constructing an object is expensive but you are not sure yet you are going to need it. In that case it can be handy to delay the creation of the object. But then your code may become much more complicated.

This module allows you to transparently create an intermediate object that will perform the delayed creation of the original object when **any** method is called on it.

The original Perl was is to call **any** method on the `Object::Trampoline` class, with as the first parameter the object to call that method on when it needs to be created, and the other parameters the parameters to give to that method then.

The alternate, more idiomatic Raku way, is to call the `trampoline` subroutine with a code block that contains the code to be executed to create the final object. This can also be used to serve as a lazy default value for a class attribute.

To make it easier to check whether the actual object has been created, you can check for `.defined` or booleaness of the object without actually creating the object. This can e.g. be used when wanting to disconnect a database handle upon exiting a scope, but only if an actual connection has been made (to prevent it from making the connection only to be able to disconnect it).

# PORTING CAVEATS

Due to the lexical scope of `use` in Raku, it is not really possible to mimic the behaviour of `Object::Trampoline::Use`.

Due to the nature of the implementation, it is not possible to use smartmatch (aka `~~`) on a trampolined object. This is because smartmatching a trampolined object does not call any methods on it. Fixing that by using a `Proxy` would break the `.defined` and `.Bool` functionality.

You can also not call `.WHAT` on a trampolined object. This is because `.WHAT` is internally generated as a call to `nqp::what`, and it is as yet impossible to provide candidates for nqp:: ops.

# AUTHOR

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

Source can be located at: <https://github.com/lizmat/Object-Trampoline> . 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, 2019, 2020, 2021, 2023 Elizabeth Mattijsen

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

Re-imagined from the Perl version as part of the CPAN Butterfly Plan. Perl version originally developed by Steven Lembark.


## dist_github-japhb-RPG-Base.md
[![Actions Status](https://github.com/japhb/RPG-Base/workflows/test/badge.svg)](https://github.com/japhb/RPG-Base/actions)

# NAME

`RPG::Base` - Common base components for RPGs

# SYNOPSIS

```
use RPG::Base::Container;
use RPG::Base::Creature;
use RPG::Base::Location;
use RPG::Base::Thing;

# Using the base classes directly
my $bob      = RPG::Base::Creature.new(:name('Bob the Magnificent'));
my $backpack = RPG::Base::Container.new(:name('Cloth Backpack'));
my $flint    = RPG::Base::Thing.new(:name('Flint and Steel'));
my $wand     = RPG::Base::Thing.new(:name('Ironwood Wand'));

my $clearing = RPG::Base::Location.new(:name('Grassy Clearing'));
my $grove    = RPG::Base::Location.new(:name('Oak Grove'));
my $cliff    = RPG::Base::Location.new(:name('Sheer Cliff'));

$backpack.add-thing($flint);
$bob.add-thing($_) for $backpack, $wand;

$grove   .add-exit('north' => $clearing);
$cliff   .add-exit('down'  => $clearing);
$clearing.add-exit('south' => $grove);
$clearing.add-exit('up'    => $cliff);
$clearing.add-thing($bob);

$clearing.say;  # "Grassy Clearing (exits: 2, things: 1)"
$bob.say;       # "Bob the Magnificent (RPG::Base::Creature in
                #  RPG::Base::Location 'Grassy Clearing' carrying
                #  Cloth Backpack (contents: Flint and Steel),
                #  Ironwood Wand)"

$clearing.move-thing('south' => $bob);
$clearing.say;       # "Grassy Clearing (exits: 2, things: 0)"
$bob.container.say;  # "Oak Grove (exits: 1, things: 1)"

```

# DESCRIPTION

`RPG::Base` is a set of common base concepts and components on which more complex RPG rulesets can be based. It limits itself to those concepts that are near universal across RPGs (though some games use different terminology, `RPG::Base` simply chooses common terms knowing that game-specific subclasses can be named using that game's particular terminology).

The entire point of `RPG::Base` is to be subclassable, extensible, and generic. If it turns out that one of the design choices is making that difficult, **please let me know**.

## STABILITY

`RPG::Base` is not entirely stable, as befits the low version number (though already in use as the base of considerably more complete rulesystems). A first approximation of stability can be seen by looking at the tests for each module. Modules with lots of tests but specific `XXXX` markers still have a few slushy behaviors and might change a bit; those with very few tests or even just a `plan :skip-all` at the top of the test file represent conjectured designs and are probably very much still in flux.

# CONTRIBUTING

Pull requests are very welcome! It will take the implementation of many rulesets based on `RPG::Base` to find all the common code and concepts that should be factored out, and I'm certainly not going to be implementing them all myself. That said, please be aware that if I believe the new code wouldn't work well with one of the other rulesets or will block off a useful direction for extension, I may alter the PR before merging, or ask you to consider a different approach to make sure it fits well into the ecosystem.

Please be *very* careful with copyrights and trademarks. Some of the companies that own game system intellectual property are famously litigious and it's important that any such questions stay well away from `RPG::Base` so that the "blast radius" of an IP disagreement won't include all modules depending on this one.

Stylistically, I generally keep with Larry Wall's classic formatting rules (4 space indents, uncuddled elses, opening brace on same line as the control structure it goes with, and so on). I prefer to use the Unicode forms of operators such as `»` and `∈` rather than the pure ASCII forms. Due to quirks of my brain, I will tend to favor aligning similar parts of consecutive lines when I can get it. This tends to manifest most often in variable and class attribute definitions, where I align the type names, attribute names, and default values in columns. Finally, I treat overall readability as more important than strict adherence to 80 column width, which I see as a good default because it happens to be fairly readable and guides one towards limiting the complexity of each line, not a hard limit that should be enforced with an iron will.

# AUTHOR

Geoffrey Broadwell [gjb@sonic.net](mailto:gjb@sonic.net)

# COPYRIGHT AND LICENSE

Copyright 2016-2021 Geoffrey Broadwell

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


## dist_cpan-FRITH-Math-FFT-Libfftw3.md
## Math::FFT::Libfftw3

Math::FFT::Libfftw3 - An interface to libfftw3.

## Build Status

| Operating System | Build Status | CI Provider |
| --- | --- | --- |
| Linux | [Build Status](https://travis-ci.org/frithnanth/perl6-Math-FFT-Libfftw3) | Travis CI |

## Example

```
use v6;

use Math::FFT::Libfftw3::C2C;
use Math::FFT::Libfftw3::Constants; # needed for the FFTW_BACKWARD constant

my @in = (0, π/100 … 2*π)».sin;
put @in».Complex».round(10⁻¹²); # print the original array as complex values rounded to 10⁻¹²
my Math::FFT::Libfftw3::C2C $fft .= new: data => @in;
my @out = $fft.execute;
put @out; # print the direct transform output
my Math::FFT::Libfftw3::C2C $fftr .= new: data => @out, direction => FFTW_BACKWARD;
my @outr = $fftr.execute;
put @outr».round(10⁻¹²); # print the backward transform output rounded to 10⁻¹²

```

```
use v6;

use Math::FFT::Libfftw3::C2C;
use Math::FFT::Libfftw3::Constants; # needed for the FFTW_BACKWARD constant

# direct 2D transform
my Math::FFT::Libfftw3::C2C $fft .= new: data => 1..18, dims => (6, 3);
my @out = $fft.execute;
put @out;
# reverse 2D transform
my Math::FFT::Libfftw3::C2C $fftr .= new: data => @out, dims => (6,3), direction => FFTW_BACKWARD;
my @outr = $fftr.execute;
put @outr».round(10⁻¹²);

```

For more examples see the `example` directory.

## Description

Math::FFT::Libfftw3 provides an interface to libfftw3 and allows you to perform Fast Fourier Transforms.

## Documentation

### Math::FFT::Libfftw3::C2C Complex-to-Complex transform

#### new(:@data!, :@dims?, Int :$direction? = FFTW\_FORWARD, Int :$flag? = FFTW\_ESTIMATE, Int :$dim?, Int :$thread? = NONE, Int :$nthreads? = 1)

#### new(:$data!, Int :$direction? = FFTW\_FORWARD, Int :$flag? = FFTW\_ESTIMATE, Int :$dim?, Int :$thread? = NONE, Int :$nthreads? = 1)

The first constructor accepts any Positional of type Int, Rat, Num, Complex (and IntStr, RatStr, NumStr, ComplexStr);
it allows List of Ints, Array of Complex, Seq of Rat, shaped arrays of any base type, etc.

The only mandatory argument is **@data**.
Multidimensional data are expressed in row-major order (see the [C Library Documentation](#c-library-documentation))
and the array **@dims** must be passed to the constructor, or the data will be interpreted as a 1D array.
If one uses a shaped array, there's no need to pass the **@dims** array, because the dimensions will be read
from the array itself.

The **$direction** parameter is used to specify a direct or backward transform; it defaults to `FFTW_FORWARD`.

The **$flag** parameter specifies the way the underlying library has to analyze the data in order to create a plan
for the transform; it defaults to `FFTW_ESTIMATE` (see the [C Library Documentation](#c-library-documentation)).

The **$dim** parameter asks for an optimization for a specific matrix rank. The parameter is optional and if present
must be in the range 1..3.

The **$thread** parameter specifies the kind of threaded operation one wants to get; this argument is optional and if
not specified is assumed as **NONE**.
There are three possibile values:

* NONE
* THREAD
* OPENMP

**THREAD** will use specific POSIX thread library while **OPENMP** will select an OpenMP library.

The **$nthreads** specifies the number of threads to use; it defaults to 1.

The second constructor accepts a scalar: an object of type **Math::Matrix** (if that module is installed, otherwise
it returns a **Failure**); the meaning of all the other parameters is the same as in the other constructor.

#### execute(Int :$output? = OUT-COMPLEX --> Positional)

Executes the transform and returns the output array of values as a normalized row-major array.
The parameter **$output** can be optionally used to specify how the array is to be returned:

* OUT-COMPLEX
* OUT-REIM
* OUT-NUM

The default (**OUT-COMPLEX**) is to return an array of Complex.
**OUT-REIM** makes the `execute` method return the native representation of the data: an array of couples of
real/imaginary values.
**OUT-NUM** makes the `execute` method return just the real part of the complex values.

#### Attributes

Some of this class' attributes are readable:

* @.out
* $.rank
* @.dims
* $.direction
* @.kind (available only in the R2R transform)
* $.dim (used when a specialized tranform has been requested)
* $.flag (how to compute a plan)
* $.adv (normal or advanced interface)
* $.howmany (only for the advanced interface)
* $.istride (only for the advanced interface)
* $.ostride (only for the advanced interface)
* $.idist (only for the advanced interface)
* $.odist (only for the advanced interface)
* @.inembed (only for the advanced interface)
* @.onembed (only for the advanced interface)
* $.thread (only for the threaded model)

#### Wisdom interface

This interface allows to save and load a plan associated to a transform (There are some caveats.
See [C Library Documentation](#c-library-documentation)).

##### plan-save(Str $filename --> True)

Saves the plan into a file. Returns **True** if successful and a **Failure** object otherwise.

##### plan-load(Str $filename --> True)

Loads the plan From a file. Returns **True** if successful and a **Failure** object otherwise.

#### Advanced interface

This interface allows to compose several transformations in one pass.
See [C Library Documentation](#c-library-documentation).

##### advanced(Int $rank!, @dims!, Int $howmany!, @inembed!, Int $istride!, Int $idist!, @onembed!, Int $ostride!, Int $odist!)

This method activates the advanced interface. The meaning of the arguments are detailed in the
[C Library Documentation](#c-library-documentation).

This method returns `self`, so it can be concatenated to the `.new()` method:

```
my $fft = Math::FFT::Libfftw3::C2C.new(data => (1..30).flat)
                                  .advanced: $rank, @dims, $howmany,
                                             @inembed, $istride, $idist,
                                             @onembed, $ostride, $odist;

```

### Math::FFT::Libfftw3::R2C Real-to-Complex transform

The interface for the R2C transform is slightly different.

In particular:

* in the `execute` method, when performing the reverse transform, the output array has only real values, so the `:$output` parameter is ignored.

See the `pod` documentation inside the module for further details.

### Math::FFT::Libfftw3::R2R Real-to-Real transform

This module implements several R2R transforms.
The major difference is that the constructor has a new `$kind` argument, which specifies the kind of trasform that
will be performed on the input data.

See the `pod` documentation inside the module for further details.

## C Library documentation

For more details on libfftw see [the FFTW home](http://www.fftw.org/).
The manual is available [here](http://www.fftw.org/fftw3.pdf).

## Prerequisites

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

### Debian Linux

```
sudo apt-get install libfftw3-double3

```

The module looks for a library called libfftw3.so.

## Installation

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

```
$ zef update
$ zef install Math::FFT::Libfftw3

```

## Testing

To run the tests:

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

```

## Notes

Math::FFT::Libfftw3 relies on a C library which might not be present in one's
installation, so it's not a substitute for a pure Perl 6 module.
If you need a pure Perl 6 module, Math::FourierTransform works just fine.

This module needs Perl 6 ≥ 2018.09 only if one wants to use shaped arrays as input data. An attempt to feed a shaped
array to the `new` method using `$*PERL.compiler.version < v2018.09` results in an exception.

## TODO

There are some alternative interfaces to implement:

* The *guru* interface to apply the same plan to different data.
* The *distributed-memory* interface, for parallel systems supporting the MPI message-passing interface.

## Author

Fernando Santagata

## Copyright and license

The Artistic License 2.0