## dist_zef-tony-o-flow.md
# flow

## a pp6 implementation of prove with the ability to adapt to *newer* methods of testing

`flow` is intended to be an extensible `prove` replacement written entirely in `perl6`. it's written in a way that it can be configured to use any new testing methods (think: a harness designed for parallel testing, like `mocha`). can't prove do this? kind of, you can run your tests through whatever you'd like as long as they end up in a TAP output and it will work with `prove`.

with `flow`, there isn't any need to translate your test files into TAP as long as there is a `::Plugin` available for how you write your tests.

# current state

`flow` ships with only parsing `TAP` output, there are other testing harnesses out there but they're not widely used if at all.

`flow` is being released in the environment to try and help test the TAP output parsing and provide a speedier alternative to plain `prove` (`prove -j9` is faster on my system for modules with very few tests/scripts but `prove` isn't commonly run this way by package installers)

# `flow` vs `prove`

Here is the benchmark for `Bailador` module - chosen since it has a medium level of testing -

### Script

```
# !/usr/bin/env perl6

use Bench;

my $b = Bench.new;

$b.cmpthese(500, {
  prove  => sub {
    qx<prove -j9 -e 'perl6 -Ilib' t/>;
  },
  flow   => sub {
    qx<perl6 -I../../p6-flow/lib ../../p6-flow/bin/flow test>;
  }
});

```

### Benchmark

```
tonyo@mbp:~/projects/benchmark/Bailador$ ./prove-vs-flow.pl6
Benchmark:
Timing 500 iterations of flow, prove...
      flow: 1728.3408 wallclock secs @ 0.2893/s (n=500)
           prove: 3006.5033 wallclock secs @ 0.1663/s (n=500)
           O-------O--------O-------O------O
           |       | s/iter | prove | flow |
           O=======O========O=======O======O
           | prove | 6.01   | --    | -43% |
           | flow  | 3.46   | 74%   | --   |
           ---------------------------------

```

# what is being worked on now

* interface changes
* having the tests stream live results instead of just the end result
* more configuration options

# usage

Current directory:

`flow test`

Some other directory or directories:

`flow test [<dir>]`

# installation

`zef install flow`

or

`panda install flow`

# license

[WTFPL](http://www.wtfpl.net/about/)


## dist_zef-librasteve-CLI-Wordpress-Migrator.md
# NAME

CLI::Wordpress::Migrator

# GETTING STARTED

```
zef install CLI::Wordpress::Migrator

```

# SYNOPSIS

```
> rawm
Usage:
  ./rawm [--ts=<Str>] [--backup-only] [--download-only] [--upload-only] [--restore-only] [--cleanup-only] [--dry-run] <cmd>

    <cmd>              One of <connect export install import search-replace migrate>
    --ts=<Str>         Enter timestamp of files [Str] eg. --ts='20241025-17-02-42'
    --backup-only      Only perform remote backup
    --download-only    Only perform download (requires timestamp [--ts])
    --upload-only      Only perform upload (requires timestamp [--ts])
    --restore-only     Only perform restore (requires timestamp [--ts])
    --cleanup-only     Only perform remote cleanup
    --dry-run          Do not perform replace

```

# DESCRIPTION

CLI::Wordpress::Migrator is a script to migrate a Wordpress site from one server to another. This performs export (backup), install, import (restore) and search-replace steps according to the configuration in `~/.rawm-config/rawm-config.yaml`

The process involves three systems:

* `from` server which is running the source site
* `to` server which is ready for the migrated site
* local client which connects to the export / import servers in turn

This module installs the raku `rawm` command for use from the local client command line. (RAku Wordpress Migrator).

Here is a sample config file:

```
from:
  user: myusername
  subdom: sdname
  domain: mydomain.com
  key-pub: kpname
  port: 22
to:
  user: myusername
  subdom: sdname
  domain: mydomain.com
  key-pub: kpname
  port: 22
wp-config:
  locale: en_GB
  db:
    name: dbname
    user: dbuser
    pass: dbpass
    prefix: wp_
  title: My New WP Installation
  url: mysite.com
  admin:
    user: aduser
    pass: adpass
    email: ademail

```

Notes:

1. The install Build process creates a new default config file at `~/.rawm-config/rawm-config.yaml`. To persist your (private) settings, copy and populate this file and save as `~/.rawm-config/rawm-configBAK.yaml`, then subsequent install Build process will restore your settings over the default.
2. If there is no subdomain use `subdom: _` (ie an underscore) to indicate none.

Prerequisites for connection:

* Uses `ssh -i` access. Please generate an ssh key pair, authorize and save private key in e.g. `~.ssh/id_rsa`, `chmod 400 id_rsa`

### Export

| Action | Pseudo Command |
| --- | --- |
| Connect to the `from` Server: | `ssh user@host` |
| Go to to temp dir: | `cd /path/to/temp` |
| Export the Database: | `wp db export mysite.sql` |
| Export the WordPress Files: | `tar -czf backup-fs...tar.gz /../wp-content` |
| Transfer Files to local drive: | `scp user@host:/path/to/temp .` |

### Install

Prerequisites for install (example):

* Create new (sub)domain and (sub)dir via cPanel
* Create new empty database via cPanel
* Add db user & set their permissions via cPanel
* Adjust the PHP upload max size to 512M via cPanel > PHP > Options
* Register url and adjust DNS A record to server IP
* Use TLS status refresh to get certificates via cPanel

Edit your `~/.rawm-config/rawm-config.yaml` to populate these `wp-config` private settings (and copy it to `~/.rawm-config/rawm-configBAK.yaml` if you want them to persist through a re-install).

viz. <https://make.wordpress.org/cli/handbook/how-to/how-to-install/>

| Action | Pseudo Command |
| --- | --- |
| Connect to the `to` Server: | `ssh user@host` |
| Go to to destination dir | `cd /path/to/wpserver` |
| Download WP core | `wp core download` |
| Create WP config | `wp config create` |
| Install WP core | `wp core install` |
| Adjust file/dir permissions | `chmod -R a=r,a+X,u+w .` |

### Import

| Action | Pseudo Command |
| --- | --- |
| Transfer Files to the Import Server: | `scp . user@host:/path/to/temp` |
| Connect to the Import Server: | `ssh user@host` |
| Import the Database: | `wp db import mysite.sql` |
| Extract the WordPress Files: | `tar -xzf wordpress_files.tar.gz /..` |
| Update WordPress Configuration: | `wp-config.php s/xxx/yyy/` |
| Set File Permissions[1]: | `chmod -R a=r,a+X,u+w .` |

Notes:

* a failed import (eg. "to" site has WP web admin configurator asking for info like a new install) is often caused by incorrect wp-config>db>prefix in `rawm-config.yaml`

### Search & Replace

| Action | Pseudo Command |
| --- | --- |
| Search and Replace URLs (option): | `wp search-replace 'old' 'new'` |
| Update Permalinks (option): | `wp rewrite flush` |

Postrequisites for restore (example):

* use Elementor>Tools search replace x4
* edit all SS3 sliders

# AUTHOR

librasteve [librasteve@furnival.net](mailto:librasteve@furnival.net)

# COPYRIGHT AND LICENSE

Copyright 2024 librasteve

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


## dist_github-ddlws-Radamsa.md
# radamsa

Raku bindings for radamsa, a general purpose fuzzer <https://gitlab.com/akihe/radamsa>

When you have to start fuzzing RIGHT NOW, radamsa is hard to beat. However, hidden under a mountain of parentheses in the radamsa git repo is real black magic, libradamsa, which is what these bindings are actually for. This is multithreaded fuzzing on easy mode.

### Installation

> `zef install Radamsa`

The build fetches radamsa source from <https://gitlab.com/akihe/radamsa> and builds libradamsa.so. It'll take a minute.

### Using it

`use Radamsa;`

There is one class, `radamsa`. You'll need to initialize it with good input(s).

There are three convenience constructors:

**`new(Str $s)`**

seeds radamsa with a single string

> `my $r = radamsa.new("fuzz me");`

**`new(IO::Path $p)`**

If `$p` is a file, then `$p`'s contents are the seed. If `$p` is a directory, radamsa adds every file and recurses through subdirectories. Use this to fuzz file formats.

**`new(buf8 @inputs)`**

Inputs are stored as an array of `buf8`s, so this sets it directly.

> `my $r = radamsa.new(@arrayofbuf8s);`

#### Optional parameters

**`:maxoutsz`**
This sets a byte limit for the length of radamsa's output. If you don't specify it, radamsa will set it to the length of the longest input provided to the constructor.

**`:minqsz`**

Radamsa tries to avoid idle workers by keeping a minimum number of ouputs in the queue. More detail is provided below. You can ignore this.

### Changing inputs

You can modify the inputs at runtime if you'd like to guide the fuzzer. The array of inputs is directly accessible through `$r.inputs` (an array of buf8s) or through **`addinput(Blob)`**, **`addinput(Str)`**, or **`addinput(IO::Path)`**.

Radamsa will randomly choose one input for each ouput it generates, so choose your inputs wisely.

### Getting output

All results are `buf8` because there's no telling what you'll get.

**`gen1()`**

Returns a single item of output.

```
> for ^10 { say $r.gen1.decode }
fuzzfzzfuzzfuzz mefuzz me mefuzme
fuzz me mefuzz me
fuzz me mefuzz me mefuzz me
  mefuzz me
fuzz mefuzz me

fuz me
Malformed UTF-8 at line 1 col 1
  in block <unit> at <unknown file> line 1

```

### Getting a lot of ouput

The radamsa class is a Raku `Channel`, so you can call `.receive` on it. The queue will be empty until you initialize it with `.startchannel`. This starts a worker thread that tries to keep at least `$.minqsz` items available on the channel. Radamsa will naively increase its minqsz whenever the queue gets too short. It's not PID control, but it works for most usecases. You can outrun libradamsa with very quick tests. If that happens, ignore it or use fewer threads; libradamsa isn't thread safe.

Here is an example that writes to some temp files.

```
use Radamsa;
my $r = radamsa.new("go fuzz your software", :maxoutsz(100), :minqsz(100));
$r.startchannel();
my $keepgoing = True;
my @workers;
for ^10 {                                           # starting 10 threads
    my $fh = ('/tmp/libradtest'~$_).IO.open(:w);
    @workers.push(
        start {
            while ?$keepgoing {
                my $b = $r.receive;
                $b.append(0x0a);                    # newline to make it somewhat readable
                $fh.write($b);
            }
            $fh.close;
        }
    );
}
sleep 5;
$keepgoing = False;
await @workers;

```

and some of it's output

```
> head -n 5 /tmp/libradtest*
==> /tmp/libradtest0 <==
go fuzó   z your software
go fuzzË‘ Êµyour software
â€ó  ƒ‡go óÊ¶  §fuzz your sr sofï¿¿twaâ §ró  še
go fuzz your softwó  ³are
go fuzz your softwarego fuzz your só  ›oftware

==> /tmp/libradtest1 <==
go fuzz your ÷dLsoftware
g„1•259ó  €o fó €»uzzó  Žó  «ó  ´ your só ó  „ žoâ ¥ftware
go fuzz yoâ€ó €²‡ur sofáš€twaró €¢ó € e
go fuzz y só  ›o fuzz your software
go fuzz your softward

==> /tmp/libradtest2 <==
go fuzó  »z your software
go fuzz softwarego fuzz yoï»¿ur software
ó  go fuzz your software
go fuzz your softwarego fuzz your softwarego fuzz your softwarego fuzz your softwaregoï¼  fuzz your
go fuzz xour softw`re

==> /tmp/libradtest3 <==
go fuzz your â€¬software
go fuzz your softwarego fuzz your só  ›oftwarer software
go fuzzó  … your software
go fu fuzz youzz your softwarego fuzz your só  ›oftwarego fuzz your só  ›oftware
go ftware

==> /tmp/libradtest4 <==
à¿go fuó  «zz yougo fuzz fuô 	¿¾zz your sÂ·ó  ›oftware
go fuzz your software
go fuzz yoó  ”ur software
go fuzz your sofó €¼tware
go fuzz your softwarego fuz

==> /tmp/libradtest5 <==
go fuzz your softwarego fuzz your softwarego fuzz your softwarego fuzz your softwarego fuzz your sof
go fuzz â€Šyour só  ¿oftwaróÂ·  ˜e
go fuzz your sofÂ tware
âó  »€ó  •á Žóó  ” €½„óï¬¬ ó ó  ’ Ÿgo fuzz yo fuzz your só  ›oftwarer software
go ftó  ›ware

==> /tmp/libradtest6 <==
go fuzó  ó  ©•z your software
go fuzz yoó €¹ur software
go fuzz your softwarego fuzz your só  ›oftware
goó  ur software
go your softwaretó  šsoftó  ‘ó  šsoftó  šsoftó  šsoftó  šsoftware

==> /tmp/libradtest7 <==
go fuz z your so fuzz your software
go Ê°fþÿuzz your soâ€®ftâ §warego fuó  ³zz yó €¯our só  ›ó  ‰oftware
go fuzz your software
go fuzz your software
ó  šsoftó  ftware

==> /tmp/libradtest8 <==
go fuzz yoâ€ˆur ó  ™software
go fuzz your softwarego fuzz your software
go fó €¤uzz yó  †our software
go fuzz your softwarez yoï»¿ur software
go fuzz your softó  ›ware

==> /tmp/libradtest9 <==
go fuzz you
go fuzz your softwarego fuzzgo fuzz your softwarego fuzz your só  ›oftware
go fuzz yoï»¿ur softwaregoe
go fuzz your softwarego fuzz your só  ›oftware
go fuï· zz your ó  šsofuzz ougo â€ªfuzz your softwarego fuzz your softwarego fuzz your só ó €± ›oftw

```


## dist_cpan-FISCHER-Lingua-Pangram.md
# Lingua::Pangram

Module and script for checking whether a string is a pangram.

[![Release](https://img.shields.io/github/release/sfischer13/perl6-Lingua-Pangram.svg?style=flat-square)](https://github.com/sfischer13/perl6-Lingua-Pangram/releases) [![License](https://img.shields.io/github/license/sfischer13/perl6-Lingua-Pangram.svg?style=flat-square)](https://github.com/sfischer13/perl6-Lingua-Pangram/blob/master/LICENSE) [![Travis](https://img.shields.io/travis/sfischer13/perl6-Lingua-Pangram.svg?style=flat-square)](https://travis-ci.org/sfischer13/perl6-Lingua-Pangram)

---

## Introduction

`Lingua::Pangram` is a Perl 6 module for checking whether a string is a pangram.

## Installation

```
# latest release
zef install Lingua::Pangram

# specific version
zef -v install https://github.com/sfischer13/perl6-Lingua-Pangram.git@v0.1.1

# developer version
zef -v install https://github.com/sfischer13/perl6-Lingua-Pangram.git

```

## Development

```
git archive --prefix=Lingua-Pangram-0.1.0/ -o ../Lingua-Pangram-0.1.0.tar.gz HEAD

```

## Credits

This project is authored and maintained by Stefan Fischer.
The source code is available under the **MIT License**.
See [LICENSE](https://github.com/sfischer13/perl6-Lingua-Pangram/blob/master/LICENSE) for further details.


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

# NAME

Code::Coverage - produce code coverage reports

# SYNOPSIS

```
use Code::Coverage;

my $coverage := Code::Coverage.new(
  targets => @modules,
  runners => @test-scripts
);

$coverage.run;

say .key ~ ": " ~ .value for $coverage.missed;

```

# DESCRIPTION

Code::Coverage is a class that contains the logic to run one or more Raku programs and produce code coverage of one or more targets (usually modules).

# METHODS

## new

```
my $cc := Code::Coverage.new(
  targets => @modules,
  runners => @test-scripts,
  extra   => "-I.",    # default: none
  repo    => $repo,    # default: $*REPO
  tmpdir  => ".",      # default: %*ENV<TMPDIR> // $*HOME
  slug    => "foobar", # default: "code-coverage-"
  keep    => True,     # default: False
);

$cc.run;
say "$cc.coverage() of code was covered";

```

The `new` method accepts the following named arguments:

### :targets

The `targets` named argument indicates one or more targets for which coverage information should be created. Each of these can be specified as a path (either as string, or as an `IO::Path` object), or as a `use` target (identity) such as "`String::Utils`".

Whatever was specified, will be returned by the `targets` method.

### :runners

The `runners` named argument indicates the paths of one or more scripts that should be executed to determine coverage information. It should specify at least one script.

Whatever was specified, will be returned by the `runners` method.

### :extra

The `extra` named argument indicates any extra command line arguments that should be set when calling the `:runners` scripts. By default, no extra arguments are added. A typical usage would be "-I." to ensure that the current source of a module is used.

Whatever was specified, will be returned by the `extra` method.

### :repo

The `repo` named argument indicates the `CompUnit::Repository` object to be used when coverable lines are being deduced from bytecode. It defaults to `$*REPO`, aka the default repository chain.

Whatever was specified, will be returned by the `repo` method.

### :tmpdir

The `tmpdir` named argument specifies the path of the directory that should be used to store the temporary coverage files. It defaults to the `TMPDIR` environment variable, or the home directory as known by `$*HOME`.

Whatever was (implicitely) specified, will be returned by the `tmpdir` method.

### :slug

The `slug` named argument specifies the prefix of the coverage files to be created. It defaults to "code-coverage-".

Whatever was (implicitely) specified, will be returned by the `slug` method.

### :keep

The `keep` named argument specifies whether the temporary coverage files should be kept or not. Defaults to `False`, which means that any coverage files will be removed after each call to `.run`.

Whatever was (implicitely) specified, will be returned by the `keep` method.

## run

```
$cc.run("foo");  # test the "foo" code path
$cc.run("bar");  # test the "bar" code path

```

The `run` method will execute all of the `:runners` scripts, gather the coverage information, and update all internal information as applicable.

Any positional arguments specified will be added as command line arguments to the `:runners` scripts. Note that it is fully ok to call this method more than once with a different set of parameters, to test different code paths in the runners.

## out

```
print $cc.out;

```

The `out` method returns the collected STDOUT output of all of the `:runners` scripts since the last time the `run` method was executed.

## err

```
print $cc.err;

```

The `err` method returns the collected STDERR output of all of the `:runners` scripts since the last time the `run` method was executed.

## coverables

```
for $cc.coverables.values {
    say .source.relative;
    say .line-numbers;
}

```

The `coverables` method returns a `Map` with [`Code::Coverable`](https://raku.land/zef:lizmat/Code::Coverable) objects created for the `:targets` specified, keyed by coverage key that will appear in coverage logs.

## keys

```
say "Coverage keys:";
.say for $cc.keys;

```

The `keys` method returns the coverage keys that were found for the given targets.

## covered

```
say "Lines covered";
for $cc.covered {
    say .key ~ ":\n$_.value.join(',')\n";
}

```

The `covered` method returns a `Map`, keyed by coverage key, with all of the lines that appear to have been covered by executing the runner scripts (possibly multiple times).

## missed

```
say "Lines NOT covered";
for $cc.missed {
    say .key ~ ":\n$_.value.join(',')\n";
}

```

The `missed` method returns a `Map`, keyed by coverage key, with all of the lines that appear to have **NOT** been covered by executing the runners (possibly multiple times).

## coverage

```
say "Coverage:"
for $cc.coverage {
    say .key ~ ": " ~ .value;
}

```

The `coverage` method returns a `Map`, keyed by coverage key, with as value a string containing the percentage of lines that were covered so far by executing the runners (possibly multiple times).

## sources

```
say "Source files:"
for $cc.sources {
    say .key ~ ": " ~ .value.absolute;
}

```

The `sources` method returns a `Map`, keyed by coverage key, with an `IO::Path` object for the associated source file as the value.

## source

```
say "$key: $cc.source($key).relative";

```

The `source` method returns an `IO::Path` object for the source file associated with the given coverage key.

## annotated

```
print $cc.annotated($key);

```

The `annotated` method produces the contents of the source-file indicated by the coverage key, with each line annotated with the coverage result. The following annotations are given:

* `*` - line was coverable, and covered
* `✱` - line was **not** coverable, but covered anyway
* `x` - line was coverable and **not** covered
* `` - line was not coverable

## num-coverable-lines

```
say $cc.num-coverable-lines;

```

The `num-coverable-lines` method returns the total number of lines that are marked coverable in all coverage keys.

## num-covered-lines

```
say $cc.num-covered-lines;

```

The `num-covered-lines` method returns the total number of lines that are marked covered in all coverage keys.

## num-missed-lines

```
say $cc.num-missed-lines;

```

The `num-missed-lines` method returns the total number of lines that are marked coverable, but have not been covered in all coverage keys (yet).

## max-lines

```
say $cc.max-lines; # max number of lines that can be covered

```

The `max-lines` method returns the maximum number of lines that can be covered. In some edge cases, this may actually be greater than the number of lines that are marked coverable because some lines may appear in the coverage log that were **not** marked as coverable.

# AUTHOR

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

Source can be located at: <https://github.com/lizmat/Code-Coverage> . 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 2024, 2025 Elizabeth Mattijsen

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


## dist_github-labster-File-Directory-Tree.md
# p6-file-directory-tree

| last push to main | [Linux Status](https://github.com/labster/p6-file-directory-tree/actions) | [MacOS Status](https://github.com/labster/p6-file-directory-tree/actions) | [Windows Status](https://github.com/labster/p6-file-directory-tree/actions) |
| --- | --- | --- | --- |
| scheduled health check | [Linux Status](https://github.com/labster/p6-file-directory-tree/actions) | [MacOS Status](https://github.com/labster/p6-file-directory-tree/actions) | [Windows Status](https://github.com/labster/p6-file-directory-tree/actions) |

Raku module to create and delete directory trees.

## SYNOPSIS

```
use File::Directory::Tree;

# make a new directory tree
mktree "foo/bar/baz/quux";
# delete what you just made
rmtree "foo";
# clean up your /tmp -- but don't delete /tmp itself
empty-directory "/tmp";

```

## DESCRIPTION

This module provides recursive versions of mkdir and rmdir. This might be useful for things like setting up a repo all at once.

## FUNCTIONS

#### mktree

Makes a directory tree with the given path. If any elements of the tree do not already exist, this will make new directories.

```
sub mktree ($path, $mask = 0o777)

```

Accepts an optional second argument, the permissions mask. This is supplied to mkdir, and used for all of the directories it makes; the default is `777` (`a+rwx`). It takes an integer, but you really should supply something in octal like 0o755 or :8('500').

Returns True if successful.

#### rmtree

This deletes all files under a directory tree with the given path before deleting the directory itself. It will recursively call unlink and rmdir until everything under the path is deleted.

Returns True if successful, and False if it cannot delete a file.

#### empty-directory

Also deletes all items in a given directory, but leaves the directory itself intact. After running this, the only thing in the path should be '.' and '..'.

Returns True if successful, and False if it cannot delete a file.

## TODO

* Probably handle errors in the test file better

## SEE ALSO

* [IO::Path](https://docs.raku.org/type/IO::Path)
* [File::Spec](https://github.com/FROGGS/p6-File-Spec) (now part of [IO::Spec](https://docs.raku.org/type/IO::Spec))

## AUTHOR

Brent "Labster" Laabs, 2013.

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

Based loosely on code by written Daniel Muey in Perl 5's [File::Path::Tiny](http://search.cpan.org/~dmuey/File-Path-Tiny-0.5/lib/File/Path/Tiny.pod).

## COPYRIGHT

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


## bind.md
class X::Bind

Error due to binding to something that is not a variable or container

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

If you write code like this:

```raku
floor(1.1) := 42;

```

it dies with an `X::Bind` exception:

｢text｣ without highlighting

```

```

Cannot use bind operator with this left-hand side

```

```


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

# NAME

Raku port of Perl's Time::gmtime module

# SYNOPSIS

```
use Time::gmtime;
$gm = gmtime;
printf "The day in Greenwich is %s\n",
   <Sun Mon Tue Wed Thu Fri Sat Sun>[ $gm.wday ];

use Time::gmtime :FIELDS;
gmtime;
printf "The day in Greenwich is %s\n",
   <Sun Mon Tue Wed Thu Fri Sat Sun>[ $tm_wday ];

$now = gmctime();

use Time::gmtime;
$date_string = gmctime($file.IO.modified);

```

# DESCRIPTION

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

This module's default exports a `gmtime` and `gmctime` functions. The `gmtime` function returns a "Time::gmtime" object. This object has methods that return the similarly named structure field name from the C's tm structure from time.h; namely sec, min, hour, mday, mon, year, wday, yday, and isdst.

You may also import all the structure fields directly into your namespace as regular variables using the :FIELDS import tag. (Note that this still exports the functions.) Access these fields as variables named with a preceding tm\_. Thus, `$group_obj.year` corresponds to `$tm_year` if you import the fields.

The `gmctime` function provides a way of getting at the scalar sense of the `gmtime` function in Perl.

# PORTING CAVEATS

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

# AUTHOR

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

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

# COPYRIGHT AND LICENSE

Copyright 2018, 2019, 2020, 2021 Elizabeth Mattijsen

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

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


## dist_cpan-MELEZHIK-Sparrowdo.md
# Sparrowdo

Sparrow Based Configuration Management Tool.

# Build status

[![Build Status](https://travis-ci.org/melezhik/sparrowdo.svg)](https://travis-ci.org/melezhik/sparrowdo)

# Install

```
zef install Sparrowdo

```

# Usage

```
sparrowdo --host=remote-host [options]

```

For example:

```
# ssh host, bootstrap first, use of local repository
sparrowdo --host=13.84.166.232  --repo=file:///home/gimy/repo --verbose  --bootstrap

# docker host, don't add sudo
sparrowdo --docker=SparrowBird --no_sudo

# localhost, with sudo
sparrowdo --localhost

# read hosts from file
sparrowdo --host=hosts.raku

```

# DSL

Sparrow6 DSL is high level functions to manage configurations.

Just create a file named `sparrowdo` in current working directory and add few functions:

```
$ cat sparrowfile

user 'zookeeper';

group 'birds';

directory '/var/data/avifauna/greetings/', %( owner => 'zookeeper' );

file-create '/var/data/avifauna/greetings/sparrow.txt', %(
    owner => 'zookeeper',
    group => 'birds',
    mode  => '0644',
    content => 'I am little but I am smart'
);

service-start 'nginx';

package-install ('nano', 'ncdu', 'mc' );

```

The full list of function is available at [Sparrow6 DSL](https://github.com/melezhik/Sparrow6/blob/master/documentation/dsl.md)
documentation.

If DSL is not enough you can call any Sparrow6 plugin using `task-run` function:

```
task-run "show me your secrets", "azure-kv-show", %(
  kv      => "Stash" # key vault name
  secret  => ( "password", "login" ) # secret names
)

```

## DSL vs `task-run` function

DSL is high level adapter with addition of some "syntax sugar" to make a code concise and readable.

DSL functions are Perl6 functions, you take advantage of input parameters validation.

However DSL is limited. Not every Sparrow6 plugin has related DSL function.

Once we've found some Sparrow6 plugin common enough we add a proper DSL wrapper for it.

In case you need more DSL wrappers let us know!

# Sparrowdo workflow

```
  ====================                                   ====================
  |                  |  --- [ Bootstrap ]                |                  | LocalHost
  |    MasterHost    |  --- [ Sparrowdo Scenario ] --->  |    TargetHost    | Docker
  |                  |               *                   |                  | Ssh
  ====================               |                   ====================
   {Sparrow6 Module}                 |                    {Sparrow6 Module}
                                      \    parameters
                                       \-----------------> [ tasks ]
                                                            ^  ^  ^
                                                           /  /  /
                             ------------                 /  /  /
                            { Repository } ---------------------
                             ------------        [ plugins ]
                             ------------
                            /      |     \
                           /       |      \
                          /        |       \
                         /         |        \
                      [CPAN]   [RubyGems] [PyPi]

```

## Master host

Master host is where Sparrow6 tasks "pushed" to target hosts.

Sparrowdo should be installed on master host:

```
$ zef install Sparrowdo

```

## Sparrowdo scenario

Sparrowdo scenario is collection of Sparrow6 tasks executed on target host.

## Target hosts

Target hosts are configured by Sparrow6 which should be installed there as well:

```
$ zef install Sparrow6

```

## Bootstrap

Bootstrap is process of automation of Sparrow6 installation on target host:

```
$ sparrowdo --host=192.168.0.1 --bootstrap

```

Bootstrap runs under `sudo` and requires sudo privileges on target host.

## Sudo

Execution of Sparrow6 tasks on target host is made under `sudo` by default, to disable this use `no_sudo` flag:

```
$ sparrowdo --docker=brave_cat --no_sudo # We don't need sudo on docker

```

## Various types of target hosts

Once sparrowfile is created it could be run on target host.

Ssh host:

```
$ sparrowdo --host=192.168.0.1

```

Docker container:

```
$ sparrowdo --docker=old_dog

```

Localhost:

```
$ sparrowdo --localhost

```

## Repositories

Sparrowdo use Sparrow6 repository to download tasks that are executed on target hosts.

During scenario execution Sparrowdo pulls plugins from repository and runs it *with parameters*.

Plugin that gets run with parameters is a Sparrow6 task.

* Detailed explanation of Sparrow6 tasks is available at [Sparrow6 development](https://github.com/melezhik/Sparrow6/blob/master/documentation/development.md) documentation.
* Detailed explanation of Sparrow6 plugins [Sparrow6 plugins](https://github.com/melezhik/Sparrow6/blob/master/documentation/plugins.md) documentation
* Detailed explanation of Sparrow6 repositories is available at [Sparrow6 repositories](https://github.com/melezhik/Sparrow6/blob/master/documentation/repository.md) documentation.

By default local repository located at `~/repo` is used:

```
$ sparrowdo --host=192.168.0.1 #  using repo ~/repo

```

Use `--repo` flag to set repository URI. For example:

```
$ sparrowdo --repo=file:///tmp/repo --localhost # use /tmp/repo repository for local mode

$ docker run --name --name=fox -d sh -v /tmp/repo:/var/data

$ sparrowdo --repo=/var/data --docker=fox --repo=file://var/data # mount /tmp/repo to /var/data within docker instance

$ sparrowdo --repo=http://sparrow.repo # use http repository

```

Ssh mode supports synchronizing local file repositories with master and target host using scp.
It extremely useful if for some reason you can't use http based repositories:

```
# scp local repository /tmp/repo to target host
# and use it within target host

$ sparrowdo --sync=/tmp/repo --host=192.168.0.1

```

Read [Sparrow6 documentation](https://github.com/melezhik/Sparrow6/blob/master/documentation/repository.md)
to know more about Sparrow6 repositories.

# Sparrowdo files anatomy

When Sparrowdo scenario executed there are might be *related* that get *copied* to a target host,
for convenience, so that one can reliably refer to those files inside Sparrowdo scenario.

Thus Sparrowdo *project* might consists of various files and folders:

```
.
├── conf
│   └── alternative.pl6
├── config.pl6
├── data
│   └── list.dat
├── files
│   └── baz.txt
├── sparrowfile
└── templates
    └── animals.tmpl

```

* `sparrowfile`

The minimal setup is just `sparrowfile` placed in the current working directory.

That file contains Sparrowdo scenario to be executed.

One may optionally define other data that make up the whole set up:

* `conf`

Directory to hold configuration files

* `config.pl6`

Default configuration file, if placed in current working directory will define Sparrowdo configuration, see
also [scenarios configuration](#scenario-configuration) section, alternatively one may place configuration file to `conf` directory and
choose to run with that file:

```
$ sparrowdo --conf=conf/alternative.pl6

```

* `files`

Directory containing files, so one could write such a scenario:

```
file "/foo/bar/baz.txt", %( source => "files/baz.txt" )

```

* `templates`

The same as `files` directory, but for templates, technically `templates` and `files` as equivalent, but
named separately for logical reasons. Obviously one can populate templates using that directory:

```
template-create '/var/data/animals.txt', %(
  source => ( slurp 'templates/animals.tmpl' ),
  owner => 'zookeeper',
  group => 'animals' ,
  mode => '644',
  variables => %(
    name => 'red fox',
    language => 'English'
  ),
);

```

* `data`

The same as `files` and `templates` folder but to keep "data" files, just another folder
to separate logically different pieces of data:

```
file "/data/list.txt", %( source => "data/list.dat" )

```

# Scenario configuration

If `config.pl6` file exists at the current working directory it *will be
loaded* via Perl6 [EVALFILE](https://docs.perl6.org/routine/EVALFILE) at the *beginning* of scenario.

For example:

```
$ cat config.pl6

{
  user         => 'foo',
  install-base => '/opt/foo/bar'
}

```

Later on in the scenario you may access config data via `config` function, that returns
configuration as Perl6 Hash object:

```
$ cat sparrowfile

my $user         = config<user>;
my $install-base = config<install-base>;

```

To refer configuration files at arbitrary location use `--conf` parameter:

```
$ sparrowdo --conf=conf/alternative.conf

```

See also [Sparrowdo files anatomy](#sparrowdo-files-anatomy) section.

# Including other Sparrowdo scenarios

Because Sparrowdo scenarios are Perl6 code files, you're free to include other scenarios into
"main" one using via Perl6 [EVALFILE](https://docs.perl6.org/routine/EVALFILE) mechanism:

```
$ cat sparrowfile

EVALFILE "another-sparrowfile";

```

Including another scenario does not include related files (`data`, `files`, `templates`) into main one,
so you can only reuse Sparrowdo scenario itself, but not it's *related* files.

# Bootstrap and manual install

To ensure that target hosts has all required Sparrow6 dependencies one may choose bootstrap mechanism that
installs those dependencies on target host. This operation is carried out under `sudo`.

Bootstrap is disabled by default and should be enabled by `--bootstrap` option:

```
$ sparrowdo --host=192.168.0.1 --bootstrap

```

Be aware that all dependencies will be installed *system wide* rather then user account, because `sudo` is used.

if you don't want bootstrap target host, you can always choose to install Sparrow6 zef module
on target host, which is enough to start using Sparrowdo to manage target host:

```
$ zef install Sparrow6

```

# Run Sparrowdo on docker

Sparrowdo supports docker as target host, just refer to running docker container by name to
run Sparrowdo scenario on it:

```
$ sparrowdo --docker=running-horse

```

# Run Sparrowdo on ssh hosts

This is probably one the most common use case for Sparrowdo - configuring servers by ssh:

```
$ sparrowdo --host=192.168.0.1

```

# Run Sparrowdo in local mode

In case you need to run sparrowdo on localhost use `--localhost` flag:

```
$ sparrowdo --localhost

```

# Sparrowdo cli

`sparrowdo` is Sparrowdo cli to run Sparrowdo scenarios, it accepts following arguments:

* `--host`

One of two things:

Ssh host to run Sparrowdo scenario on. Default value is `127.0.0.1`. For example:

```
  --host=192.168.0.1

```

Path to raku file with dynamic hosts configuration. For example:

```
  --host=hosts.raku

```

This will effectively runs Sparrowdo in asynchronous mode through a Sparky backend.
See [Dynamic hosts](https://github.com/melezhik/sparrowdo/wiki/Dynamic-hosts) wiki.

* `--docker`

Docker container name to run Sparrowdo scenario on, none required.

* `--localhost`

If set, runs Sparrowdo in localhost, in that case Sparrow6 tasks get run directly without launching ssh

* `--ssh_user`

If set defines ssh user when run Sparrowdo scenario over ssh, none required.

* `--ssh_port`

If set defines ssh port to use when run Sparrowdo scenario over ssh. Default value is 22.

If set, run Sparrowdo scenario on localhost, don't confuse with `--host=127.0.0.1` which
runs scenario on the machine but using ssh.

* `--repo`

Defines Sparrow6 repository `URI`, for example:

```
--repo=https://192.168.0.1 # Remote http repository

--repo=file:///var/data/repo # Local file system repository

```

If `--repo` is not set, Sparrowdo uses default local repository located at `~/repo` path.

Sparrowdo uses repository to pull plugins from, see also [Sparrowdo workflow](#sparrowdo-workflow) section.

See also [Sparrow6 Repositories](https://github.com/melezhik/Sparrow6/blob/master/documentation/repository.md)
documentation.

* `--sync`

If set synchronize local file system repository with target hosts using `scp`, it's useful if for some reasons
remote http repositories are not available or disable, so one can *automatically copy* repository from master host
to target. `--sync` parameter value should file path pointing repository directory at master host:

```
--sync=/var/data/repository

```

* `--no_index_update`

If set, don't request Sparrow6 repository update. Useful when in limited internet and using http based remote repositories.

* `--dry_run`

Runs in dry run mode. Only applies when run in asynchronous mode through a Sparky backend.

See [Dynamic hosts](https://github.com/melezhik/sparrowdo/wiki/Dynamic-hosts) wiki.

* `--tags`

Set host(s) tags, see [Dynamic hosts](https://github.com/melezhik/sparrowdo/wiki/Dynamic-hosts#tags) wiki.

* `--verbose`

If set print additional information during Sparrowdo scenario execution.

* `--debug`

If set, runs Sparrow6 tasks in `debug` mode, giving even more information, during scenario execution.

* `--prefix`

If set, define path to be appending to local cache directory on target host, used predominantly
when running concurrent Sparrowdo scenario on one target host, for example in Sparky CI server.
None required, no default value.

# Advanced topics

[Run Sparrowdo scenarios in asynchronous mode, using Sparky backend](https://github.com/melezhik/sparrowdo/blob/master/doc/sparky-integration.md)

# Author

Alexey Melezhik

# See also

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

# Thanks

To God as the One Who inspires me to do my job!


## dist_github-MattOates-BioInfo.md
# BioInfo [Build Status](https://travis-ci.org/MattOates/BioInfo)

BioInfo is a reimagining of bioinformatics libraries for Perl6 based on all the new goodies available such as parallel processing through Promises and Channels and well defined and extensible parsing with the use of Grammars. Not to be confused with the [bioperl6](https://github.com/cjfields/bioperl6/) project lead by [Chris Fields](http://www.bioperl.org/wiki/User:Cjfields) which aims to be a reimplementation of the BioPerl API for Perl6. Checkout Chris' project for any serious business.

### The Good

* Being built to work in parallel use cases so you don't have to worry too much about this yourself.
* Using sped up parse as you go forms of Perl6 Grammars so that a whole file isn't read into RAM and you can just play with getting higher level objects quickly.
* I'll attempt to work on reasonable requests for anything, pull requests are welcome just maybe contact me first if you have to make some big architectural decisions to get what you want.
* A fresh project for anyone who has an opinon to get involved pushing that opinion on others.

### The Bad

* I'm mostly ignoring BioPerl.
* Like the [bioperl6](https://github.com/cjfields/bioperl6/) project I am trying things out so the API is in flux. If you want something production ready, you're going to have to help to get there.

### The Ugly

* The author of these modules ([Matt Oates](http://bioinformatics.bris.ac.uk/people/matt_oates.php)) mostly concerns himself with amino acid sequences so other considerations are secondary. Sorry about that.
* [bioperl6](https://github.com/cjfields/bioperl6/) does exist. So this is a bit of a split effort, really [bioperl6](https://github.com/cjfields/bioperl6/) should get any attention.

---

## An Example

Dealing with sequences from a file:

```
use BioInfo::Parser::FASTA;
use BioInfo::IO::FileParser;

#Spawn an IO thread that parses the file and creates BioInfo::Seq objects on .get
my $seq_file = BioInfo::IO::FileParser.new(file => 'myseqs.fa', parser => BioInfo::Parser::FASTA);

#Print all the IDs from the sequence file
while (my $seq = $seq_file.get()) {
    say $seq.id;
}

```

Using the BioInfo slang to seamlessly manipulate sequences in your code. Anything within backticks or grave accents `` will be treated as FASTA sequence data and create an array of sequence objects:

```
use BioInfo;

my @seqs = `
>ENST00000505673 cds:NOVEL_protein_coding
NGGTGTGGAGCCATAGGCTGTGAAATGTTGAAAAATTTTGCTTTACTTGGTGTTGGCACA
AGCAAAGAGAAAGGAATGATTACAGTTACAGATCCTGACTTGATAGAGAAATCCAACTTA
AATAGACAGTTCCTATTTCGTCCTCATCACATACAGAAACCTAAAAGCTACACTGCTGCT
GATGCTACTCTGAAAATAAATTCTCAAATAAAGATAGATGCACACCTGAACAAAGTATGT
CCAACCACTGAGACCATTTACAATGATGAGTTCTATACTAAACAAGATGTAATTATTACA
GCATTAGATAATGTGGAAGCCAGGAGATACGTAGACAGTCGTTGCTTAGCAAATCTAAGG
CCTCTTTTAGATTCTGGAACAATGGGCACTAAGGGACACACTGAAGTTATTGTACCGCAT
TTGACTGAGTCTTACAATAGTCATCGGGATCCCCCAGAAGAGGAAATACCATTTTGTACT
CTAAAATCCTTTCCAGCTGCTATTGAACATACCATACAGTGGGCAAGAGATAAGTTTGAA
AGTTCCTTTTCCCACAAACCTTCATTGTTTAACAAATTTTGGCAAACCTATTCATCTGCA
GAAGAAGTCTTACAGGCTCTTCAGCTTCTTCACTGTTTCCCTCTGGACATACGATTAAAA
GATGGCAGTTTATTTTGGCAGTCACCAAAGAGGCCACCCTCTCCAATAAAATTTGATTTA
AATGAGCCTTTGCACCTCAGTTTCCTTCAGAATGCTGCAAAACTATATGCTACAGTATAT
TGTATTCCATTTGCAGAAGAGGTAAGATATTCT
>ENST00000505673 peptide: ENSP00000421984 pep:NOVEL_protein_coding
XCGAIGCEMLKNFALLGVGTSKEKGMITVTDPDLIEKSNLNRQFLFRPHHIQKPKSYTAA
DATLKINSQIKIDAHLNKVCPTTETIYNDEFYTKQDVIITALDNVEARRYVDSRCLANLR
PLLDSGTMGTKGHTEVIVPHLTESYNSHRDPPEEEIPFCTLKSFPAAIEHTIQWARDKFE
SSFSHKPSLFNKFWQTYSSAEEVLQALQLLHCFPLDIRLKDGSLFWQSPKRPPSPIKFDL
NEPLHLSFLQNAAKLYATVYCIPFAEEVRYS
`;

#Print out all of the sequences, if the sequence was DNA translate to Amino Acids
for @seqs -> $seq {
    say $seq ~~ BioInfo::Seq::DNA ?? $seq.translate !! $seq;
}

```

The previous example will output the protein sequence twice since the DNA was the coding sequence for the protein. Notice that what type of sequence was automatically detected, for very short sequences this could get confused. However, it does allow for convenient and quick manipualtion of sequences.

---

## Installation

Installation is quite simple at the moment, but might become more involved once third party software is involved.

### With zef (part of the Rakudo\* distribution)

```
zef install BioInfo
perl6 -M BioInfo -e 'say BioInfo::Seq.new(id => "seq1", sequence => "MDADAFA");'

```

### By hand

```
#Get the code into your library path
cd ~/wherever_you_keep_perl6_libs
git clone 'https://github.com/MattOates/BioInfo'
#Run some tests
cd BioInfo
prove -e 'perl6 -I ./lib' -lrv t/

```

---

## License

Artistic, for now just so that I don't have to worry about hardcore Perl users being fearful of anything else.


## dist_github-azawawi-Farabi6.md
# Farabi6 [Build Status](https://travis-ci.org/azawawi/farabi6)

This is a fun Perl 6 port of the Farabi Modern Perl Editor <http://metacpan.org/module/Farabi>.
The idea here is to experiment with a Perl 6 in-browser editor running over Rakudo Perl 6.

Please use rakudo Perl 6 MoarVM backend because it is the most compatible at the
time of this writing.

Have fun!

## Installation

To run it from the local directory:

```
$ bin/farabi6
  # farabi6 will try to open http://localhost:3030 in your browser

```

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

```
$ zef install Farabi6
$ farabi6
  # farabi6 will try to open http://localhost:3030 in your browser

```

You can also change the host name and port using the following command:

```
$ farabi6 --host=localhost --port=4040

```

## Testing

To run tests:

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

```

## Author

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

## License

Artistic License 2.0


## dist_zef-leont-SQL-Abstract.md
[![Actions Status](https://github.com/Leont/sql-abstract/workflows/test/badge.svg)](https://github.com/Leont/sql-abstract/actions)

# Name

SQL::Abstract - Generate SQL from Raku data structures

# Synopsis

```
use SQL::Abstract;

my $abstract = SQL::Abstract.new(:renderer<sqlite>);
my $query = $abstract.select('table', <foo bar>, { :id(3) });
my $result = $dbh.query($result.sql, $result.arguments);

my $join = { :left<books>, :right<authors>, :using<author_id> };
my $result = $abstract.select($join, ['books.name', 'authors.name'], { :cost('<' => 10) });

```

# Description

SQL::Abstract abstracts the generation of SQL queries. Fundamentally its functionality has three components

* An AST to represent SQL queries
* A set of helpers to convert standard raku datatypes into such an AST
* A renderer to turn that AST into an SQL query

It should be able to represent any `SELECT`, `UPDATE`, `INSERT`, or `DELETE` query that is valid in both Postgresql and SQLite. This subset should be generally portable to other databases as well.

# Class SQL::Abstract

This is the main class of the module.

### new(:$renderer!, Bool :$quoting, \*%renderer-args)

This creates a new `SQL::Abstract` object.

It supports at least two named arguments:

* `Bool :$quote`
* `:$renderer`

  This can either be a `Renderer` type-object, or the name of such an object. Valid values include:

  ```
  * `'postgres'`/`SQL::Abstract::Renderer::Postgres`

  * `'sqlite'`/`SQL::Abstract::Renderer::SQLite`

  * `'mysql'`/`SQL::Abstract::Renderer::MySQL`

  ```

  The postgres renderer takes an additional argument `:$placeholders`, which takes one of the following values:

  ```
  * `'dbi'`/`SQL::Abstract::Placeholders::DBI`

    This will use DBI style `(?, ?)` placeholders

  * `'postgres'`/`SQL::Abstract::Placeholders::Postgres`

    This will use Postgres style `($1, $2)` placeholders.

  ```

  It also takes an optional argument `:$quoting`, if enabled table and column names will always be quoted.

## select

```
method select(Source(Any) $from, Column::List(Any) $columns = *, Conditions(Any) $where?, Common(Any) :$common,
Distinction(Any) :$distinct, GroupBy(Any) :$group-by, Conditions(Any) :$having, Window::Clauses(Any) :$windows,
Compound(Pair) :$compound, OrderBy(Any) :$order-by, Limit :$limit, Offset :$offset, Locking(Any) :$locking)

```

This will generate a `SELECT` query. It will select `$columns` from `$from`, filtering by $conditions.

```
my $join = { :left<books>, :right<authors>, :using<author_id> };
my $result = $abstract.select($join, ['books.name', 'authors.name'], { :cost{ '<' => 10 } });
# SELECT books.name, authors.name FROM books INNER JOIN authors USING (author_id) WHERE cost < 10

my @columns = [ 'name', :sum{ :function<count>, :arguments(*) } ];
my $counts = $$abstract.select('artists', @columns, { :name(like => 'A%') }, :group-by<name>, :order-by(:sum<desc>));
# SELECT name, COUNT(*) as sum FROM artists WHERE name LIKE 'A%' GROUP BY name ORDER BY sum DESC

```

## update

```
method update(Table(Any) $target, Assigns(Any) $assigns, Conditions(Any) $where?,
Common(Any) :$common, Source(Any) :$from, Column::List(Any) :$returning)

```

This will update `$target` by assigning the columns and values from `$set` if they match `$where`, returning `$returning`.

```
$abtract.update('artists', { :name('The Artist (Formerly Known as Prince)') }, { :name<Prince> });
# UPDATE artists SET name = 'The Artist (Formerly Known as Prince)' WHERE name = 'Prince'

```

## insert

### Map insertion

```
method insert(Table(Any) $target, Assigns(Any) $values, Common(Any) :$common,
Overriding(Str) :$overriding, Conflicts(Any) :$conflicts, Column::List(Any) :$returning)

```

Inserts the values in `$values` into the table `$target`, returning the columns in `$returning`

```
$abstract.insert('artists', { :name<Metallica> }, :returning(*));
# INSERT INTO artists (name) VALUES ('Metallica') RETURNING *

```

### List insertions

```
method insert(Table(Any) $target, Identifiers(Any) $columns, Rows(List) $rows, Common(Any) :$common,
Overriding(Str) :$overriding, Conflicts(Any) :$conflicts, Column::List(Any) :$returning)

```

Insert into `$target`, assigning each of the values in Rows to a new row in the table. This way one can insert a multitude of rows into a table.

```
$abstract.insert('artists', ['name'], [ ['Metallica'], ['Motörhead'] ], :returning(*));
# INSERT INTO artists (name) VALUES ('Metallica'), ('Motörhead') RETURNING *

$abstract.insert('artists', List, [ [ 'Metallica'], ], :returning<id>);
# INSERT INTO artists VALUES ('Metallica') RETURNING id

```

### Select insertion

```
method insert(Table(Any) $target, Identifiers(Any) $columns, Select(Map) $select, Common(Any) :$common,
Overriding(Str) :$overriding, Conflicts(Any) :$conflicts, Column::List(Any) :$returning)

```

This selects from a (usually different) table, and inserts the values into the table.

```
$abstract.insert('artists', 'name', { :from<new_artists>, :columns<name> }, :returning(*));
# INSERT INTO artists (name) SELECT name FROM new_artists RETURNING *

```

## upsert

```
method upsert(Table(Any) $target, Assigns(Any) $values, Conflict::Targets $targets, Common(Any) :$common,
Overriding(Str) :$overriding, Column::List(Any) :$returning)

```

This upserts data into the table: it tries to insert data but if it fails because of a unique index constraint on one of `$targets` it will update the other columns instead.

```
$abstract.upsert('phone_numbers', { :$name, :$number}, ['name']);
# INSERT INTO phone_numbers (name, number) VALUES (?, ?) ON CONFLICT (name) UPDATE number = ?

=end

=head2 delete

=begin code :lang<raku>

method delete(Table(Any) $target, Conditions(Any) $where, Common(Any) :$common,
Source(Any) :$using, Column::List(Any) :$returning)

```

This deletes rows from the database, optionally returning their values.

```
$abstract.delete('artists', { :name<Madonna> });
# DELETE FROM artists WHERE name = 'Madonna'

```

# Builder Types

Builder objects generate SQL statements using the builder pattern

```
my $builder = SQL::Abstract::Builder(:renderer<sqlite>);
my $query = $builder.on('table').where({ :1a, :b<bar> }).update({ :$b }).build;
# "UPDATE table SET b = ? WHERE a = 1 AND b = 'bar'", [ $b ]

```

## Builder

### on

```
method on(Source(Any) $name --> Builder::Source)

```

This will return a source builder for the indicated table or join

### with

```
method with(Common(Any) $cte --> Builder)

```

This returns a new `Builder` object with common table expressions injected into it.

## Builder::Source

### select

```
multi method select(Column::List(Any) $columns --> Builder::Select)
multi method select(*@columns --> Builder::Select)

```

This returns a select builder with the given columns.

### insert

```
multi method insert(Assigns(Any) $values)
multi method insert(Identifiers(Any) $main-columns, Rows(List) $main-rows)
multi method insert(Identifiers(Any) $columns, Value::Default $)

```

This returns a select builder with the given values.

```
$builder.insert({ :1a, :b<foo>, :c(Nil) }).build

```

### update

```
method update(Assigns(Any) $assigns --> Builder::Update)

```

This returns a select builder with the given assignments.

```
$builder.on('table').where({ :1a }).update({ :2a })
$builder.on('table').update({ :2a }).where({ :1a })

```

### delete

```
method delete(--> Builder::Delete)

```

This return a new delete builder for the given table

### upsert

```
method upsert(Assigns $assigns, Conflict::Targets $targets --> Builder::Insert)

```

This returns a new insert builder with an upsert clause.

### join

```
method join(Source(Any) $source, Join::Conditions() :$on)
method join(Source(Any) $source, Identifiers() :$using)
method join(Source(Any) $source, Bool :$natural)
method join(Source(Any) $source, Bool :$cross)

```

Join the target to another table.

```
$on.join('Bar', :using<id>);
$on.join('Bar', :on{ 'Foo.id' => 'Bar.foo_id' });

```

### where

```
method where(Conditions(Any) $where --> Builder::On)

```

This adds a condition to the subsequent operation, or if it's an insert operation adds those values if possible.

## Builder::Select

* method distinct(Distinction(Any) $distinct --> Builder::Select)
* method where(Conditions(Any) $where --> Builder::Select)
* method group-by(GroupBy(Any) $group-by --> Builder::Select)
* method having(Conditions(Any) $having --> Builder::Select)
* method windows(Window::Clauses(Any) $windows --> Builder::Select)
* method compound(Compound(Pair) $compound --> Builder::Select)
* method order-by(OrderBy(Any) $order-by --> Builder::Select)
* method limit(Limit(Any) $limit --> Builder::Select)
* method offset(Offset(Any) $offset --> Builder::Select)
* method locking(Locking(Any) $locking --> Builder::Select)
* method insert(Table(Any) $target, Identifiers(Any) $columns? --> Builder::Insert)

## Builder::Insert

* method overriding(Overriding(Str) $overriding --> Builder::Insert)
* method conflicts(Conflicts(Any) $conflicts --> Builder::Insert)
* method returning(Column::List(Any) $returning --> Builder::Insert)

## Builder::Update

* method from(Update::From(Any) $from --> Builder::Update)
* method where(Conditions(Any) $where --> Builder::Update)
* method returning(Column::List(Any) $returning --> Builder::Update)

## Builder::Delete

* method using(Update::From(Any) $using --> Builder::Delete)
* method where(Column::List(Any) $where --> Builder::Delete)
* method returning(Column::List(Any) $returning --> Builder::Delete)

# Helper types

SQL::Abstract uses various helper types that will generally coerce from basic datastructures:

## SQL::Abstract::Identifier

This represents an identifier (typically a table name or column name, or an alias for such). It can be coerced from a string (e.g. `"foo"` or `"foo.bar"`).

## SQL::Abstract::Identifiers

This takes either a list of `Identifier()`, or a single `Identifier()`.

```
my SQL::Abstract::Identifiers() $identifiers = <name email website>;

```

## SQL::Abstract::Source

A source is source of data, usually a table or a join. If not passed as a `Source` object it will upconvert from the following types:

* Str

  This represents the named table, e.g. `"my_table"`.
* List

  This represents the named table, with the elements of the list representing the components of the table name. E.g. `<bar baz>` is equivalent to `"bar.baz"` .
* Pair (Str => Identifier(Cool))

  This will rename the table in the value to the name in the key.
* Pair (Str => Select(Map))

  This will use the result of a subquery as if it's a table.
* Pair (Str => Function(Map))

  This will use the function as a subquery.
* Map

  This will join two `Source`s, named `left` and `right`, it requires one of the following entries to join them on:

  ```
    * Join::Conditions() :$on

    * Identifiers() :$using

    * Bool :$natural

    * Bool :$cross

  ```

  e.g. `{ :left<artist>, :right<album>, :using<album_id> }` or `{ :left<artist>, :right<album>, :on{'artist.id' => 'album.artist_id'} }`

  The first three joiners take an optional `:$type` argument that can be any of `"inner"`/`Join::Type::Inner`, `"left"`/`Join::Type::Left`, `"right"`/`Join::Type::Right` or `"full"`/`Join::Type::Full`.

## SQL::Abstract::Table does SQL::Abstract::Source

This role takes the same conversions as `Source`, but only the ones that represent a table. Unlike other sources, this can be used for mutating operations (update/insert/delete).

## SQL::Abstract::Column::List

```
my Column::List() $columns = ('name', :number(:count(*)));
# name, COUNT(*) AS number;

```

This is a list of items representing a column. Each item can either be a: much like `Identifiers`, however it will accept not just identifiers but any expression (e.g. comparisons, function calls, etc…). If given a pair it will rename the value to the key (`value AS key`). A whatever-star will represent all columns.

## SQL::Abstract::Conditions

```
my Conditions() $conditions = { :name(:like<%leon%>), :age(25..45), :country('nl'|'be'|lu') };
# name LIKE '%leon%' AND AGE BETWEEN 25 AND 45 AND country IN('nl', 'be', 'lu')

```

This is a pair, a list of pairs, a hash or an `Expression`. In the former three cases, the key (called left in the rest of this section) shall be an `Identifier()` designating a column name, or an `Expression`. The right hand side can be one of several types:

### Expression

This will be used as-is

### Any:U

This will check if the left expression is `NULL`; `:left(Any)` equals `left IS NULL`.

### Pair

This will use the key as operator to compare left against another value or expression. E.g. `:left('<' => 42)` renders like `left < 42` . The following keys are known:

* `=`
* `!=`
* `<>`
* `<`
* `<=`
* `>`
* `>=`
* `like`
* `not-like`
* `distinct`
* `not-distinct`
* `||`
* `->`
* `->>`
* `#>`
* `#>>`
* `*`
* `/`
* `%`
* `+`
* `-`
* `&`
* `|`
* `<<`
* `>>`

A few operators are not binary operators as such.

* `null`

  will do `IS NULL`, or `IS NOT NULL` if its argument is false(`:!null`).
* `in`/`not-in`

  This takes a list of values that the column will be compared to. E.g. `:in(1, 2, 3)`.
* `and`/`or`

  The logical operators take a list or arguments, that are all expanded like pair values. So `:foo(:and('>' => 3, '<' => 42))` renders as `foo > 3 AND foo < 42`

### Range

This will check if a value is in a certain range. E.g. `:left(1..42)` will render like `left BETWEEN 1 AND 42`.

### Junction

This will check against the values in the function. E.g. `:left(1|2|4)` will render like `left IN (1, 2, 4)`.

### Capture

This will be expanded as a capture expression (. E.g. `:left(\'NOW()')` will render like `left = NOW()`. If it's an `:op` expression, the column will be inserted as first/left operand: `:left(\(:op('<' => 42)))` renders like `left < 42` .

### Any

If none of the above options match, the value will be compared to as is (as a placeholder). `:left(2)` will render equivalent to `left = 2`.

## SQL::Abstract::Assigns

This takes a list of pairs, or a hash. The keys shall be a value or an expression. E.g. `:name<author>, :id(SQL::Abstract::Values::Default), :timestamp(\'NOW()')`

## SQL::Abstract::OrderBy

This takes a list of things to sort by. Much like `Column::List` this accepts identifiers and expressions, but `*` isn't allowed and pair values are interpreted as order modifier (e.g. `:column<desc>`). A hash element will be expanded as well (e.g. `{ :column<column_name>, :order<desc>, :nulls<last> }` )

## SQL::Abstract::Common

This represents a common table expression. It converts from a pair or a list of pairs, with the keys being the name and the values being either a table name, a select hash or an `SQL::Abstract::Query` object.

```
my Common() $cte = recent => { :from<users>, :columns('name', :count(:count(*)), :group-by(name) };
# WITH recent AS (SELECT name, COUNT(*) AS count FROM users GROUP BY name);
)
```

## SQL::Abstract::Locking

This takes one or more locking clauses. A locking clause is usually taken ... strings: `'update'`, C'<no key update'>, `'share'`, `'key share'`, but it can also take a pair of stregth

## SQL::Abstract::GroupBy

This takes a list of grouping elements. Usually these are just columns, but they may also be arbitrary expressions (inclusing lists of columns). A pair is taken as a function call with the key as function name and the value as arguments.

## SQL::Abstract::Conflicts

This represents one or more upsert clause. It can either be the string `'nothing'`, or a pair with the columns as keys and an `Assigns(Map)`.

```
my SQL::Abstract::Conflicts = <name organization> => { :$email };
# ON CONFLICT (name, organization) DO UPDATE email = ?

```

## SQL::Abstract::Distinction

This takes `True`for a distinct row, or a `Column::List` for specific rows that have to be distinct.

## Window::Definition

Window definiton converts from a map taking the following keys, all optional:

* Identifier(Cool) :$existing

  This takes the name of an existing window
* Column::List(Any) :$partition-by

  This lists expressions to partition the rows by, somewhat similar to a `GROUP BY`.
* OrderBy(Any) :$order-by

  The order within a frame.
* Boundary(Any) :$from

  This argument defines the starting boundary of the frame. This can be any of:

  ```
  * 'preceding'

  * :preceding($amount)

  * 'current'

  * :following($amount)

  ```

It defaults to 'preceding'.

* Boundary(Any) :$to

  This optional argument defines the ending boundary of the frame, This can be any of:

  ```
  * :preceding($amount)

  * 'current'

  * :following($amount)

  * 'following'

  ```
* Mode:D(Str) :$mode = Mode::Range

  The mode of the frame takes one of `'rows'`, `'range'` or `'groups'`, defaulting to `'range'`.
* Exclusion(Str) :$exclude

  The exclusion of the frame, it takes one of `'current row'`, `'group'`, `'ties'` or `'no others'` (the default).

```
my Window::Definition $d = { :partition-by<foo bar>, :from<current> :to(:following(5)), :exclude<ties> }
# PARTITION BY foo, bar RANGE BETWEEN CURRENT ROW AND 5 FOLLOWING EXCLUDE TIES

```

## Window::Clauses

This takes one or more pairs, with the names being windows names and the values taking window definition maps.

```
my Windows::Clauses $clauses =
    over5 => { :frame{ :preceding(5) } },
    foo => { :partition-by<foo bar>, :mode<range>, :from<current> :to(:following(5)), :exclude<ties> };
# WINDOW
#   over5 AS (ROWS 5 PRECEDING),
#   foo as (PARTITION BY foo, bar RANGE BETWEEN CURRENT ROW AND 5 FOLLOWING EXCLUDE TIES)

```

## SQL::Abstract::Limit / SQL::Abstract::Offset

These both take either an `Int` or an `Expression`.

# Capture expressions

Captures can be used in most places where Expressions can be used. They allow for SQL expressions that can't be encoded using simpler values.

There are two kinds of capture expressions. The first kind has one or more named arguments; the first will be used as literal SQL, the rest will be arguments for the literal. E.g. `\'NOW()'`.

The second kind takes a single named argument that may or may not contain a value. Currently supported are:

* Any :$bind

  This represents a placeholder variable with the given value
* Bool :$default

  This represents the `DEFAULT` keyword
* Bool :$true

  This represents the `TRUE` keyword
* Bool :$false

  This represents the `FALSE` keyword
* Bool :$null

  This represents the `NULL` keyword
* Str :$ident

  This represents an identifier (typically a column or table name)
* Bool :$star

  This represents a `*`.
* Any :$idents

  This represents a list of identifiers
* Any :$columns

  This represents a list of column expressions
* :op(@) ('not'|'+'|'-'|'~', Any $expr)

  This represents a unary operator (`NOT`, `+`, `-`, `~`).
* :op(@) ('like'|'not-like', Any $left-expr, Any $right-expr, Any $escape-expr)

  This represents a `LIKE` operator, e.h. `column LIKE '%foo?' ESCAPE '\\'`
* :op(@) ('between'|'not-between', Any $column-expr, Any $left-expr, Any $right-expr)

  This represents a `BETWEEN` expression.
* :@and

  This represents an AND expresssion. Typically the contents of this will be further capture expressions.
* :@or

  This represents an OR expresssion. Typically the contents of this will be further capture expressions.
* :@op ('in'|'not-in', Any $left-expr, Capture $ (SQL::Abstract::Select(Map) :$select!))

  This represents an expression with subquery. E.g. `foo in (SELECT bar from baz where baz.id = table.id)`.
* :@op ('in'|'not-in', Any $left-expr, \*@args)

  This represents an expression with list. E.g. `foo in (1, 2, 3)`.
* Select(Map) :$exists

  This represents an `EXISTS` expression. E.g. `\(:exists{ :from<table>, columns<1>, :where{ :id(\(:ident<outer.id>)) }` for `EXISTS(SELECT 1 FROM table WHERE id = outer.id`.
* Select(Map) :$not-exists

  This is like :exists, but negated.
* :@op ("cast", Any $expression, Str $typename)

  This is a expression. E.g. `CAST(columns AS INTEGER)`.
* :op(@) (Str $key, Any $left-expr, Any $right-expr)

  Any binary operator applied to two expressions.
* Identifier(Any) :$current

  This represents a `CURRENT FOR cursor_name` clause, typically used in an `UPDATE` or `DELETE` statement.
* List :$row

  This represents a row expression, e.g. `(a, b, c)`.
* Function(Map) :$function

  This represents a function call.
* Select(Map) :$select

  This represents a subquery expression.

# Author

Leon Timmermans [fawaka@gmail.com](mailto:fawaka@gmail.com)

# Copyright and License

Copyright 2022 Leon Timmermans

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


## dist_zef-bduggan-Map-Leaflet.md
[![Actions Status](https://github.com/bduggan/raku-map-leaflet/actions/workflows/linux.yml/badge.svg)](https://github.com/bduggan/raku-map-leaflet/actions/workflows/linux.yml)
[![Actions Status](https://github.com/bduggan/raku-map-leaflet/actions/workflows/macos.yml/badge.svg)](https://github.com/bduggan/raku-map-leaflet/actions/workflows/macos.yml)

# NAME

Map::Leaflet - Generate maps using leaflet.js

# SYNOPSIS

```
use Map::Leaflet;

my $map = Map::Leaflet.new;
$map.add-marker({ :lat(40.7128), :lon(-74.0060) }, "New York City");
$map.add-marker({ :lat(40.7589), :lon(-73.9851) }, "Empire State Building");
$map.add-marker( 40.7267, -73.9815, "Tompkins Square Park");

$map.add-geojson(q:to/GEOJSON/);
{
  "type": "Feature",
  "geometry": {
    "type": "LineString",
    "coordinates": [
      [-74.0060, 40.7128],
      [-73.9851, 40.7589],
      [-73.9815, 40.7267],
      [-74.0060, 40.7128]
    ]
  }
}
GEOJSON

my $icon = $map.create-div-icon: html => "You are here";
$map.create-marker: latlng => [40.7128, -74.0060], options => %( icon => $icon );

$map.show;

```

![output](https://github.com/user-attachments/assets/fd0b1a5f-ec57-4007-b5dd-a5daa10c85f7)

# DESCRIPTION

Generate HTML that renders a map, using the excellent leaflet.js library.

The `Map::Leaflet` class represents a map which can be rendered as HTML. Use a map object to create objects which are analogous to their javascript counterparts, and then render the entire page to generate the javascript.

There are default values for many of the leaflet objects, in an attempt to make common cases work more easily out of the box.

When creating layers, markers, icons, etc., methods named `add-*` are provided with convenient interfaces. For more control, use the `create-*` methods, which pass the options to the constructor for the corresponding object.

In other words, `create-geojson-layer(...)` is equivalent to `add-layer(Map::Leaflet::GeoJSON.new(...))`.

See the `eg/` directory for more examples.

## EXPORTS

If an argument is given when using the module, it is treated as the name of a new object to create. e.g.

```
use Map::Leaflet 'map';
map.add-marker(40.7128, -74.0060, "New York City");

```

is the same as

```
use Map::Leaflet 'map';
my \map = Map::Leaflet.new;
map.add-marker(40.7128, -74.0060, "New York City");

```

## ATTRIBUTES

All of the attributes listed here <https://leafletjs.com/reference.html#map-factory> are available as attributes in the `Map::Leaflet` object. They will be passed to the javascript constructor. For callbacks, use a `Pair` object -- the key and value will be the left and right hand side of a javascript pointy block.

## title

The title of the HTML page. Defaults to 'Map'.

## center

A hash with `lat` and `lon` keys.

## zoom

The zoom level (integer).

## width, height

The height and width of the map. Defaults to 95vw and 95vh, respectively.

## extra-css

Extra CSS to include in the HTML. The default adds a border, centers the map, and provides a class for div-icons.

## tile-provider

The tile provider to use. Defaults to 'CartoDB.Positron'. For a complete list of providers, see <https://leaflet-extras.github.io/leaflet-providers/preview/>.

Here are a few of the providers listed: `CartoDB.Positron`, `OpenStreetMap.Mapnik`, `Esri.WorldstreetMap`

## leaflet-version, leaflet-providers-version

The version of leaflet.js and leaflet-providers.js to use. Defaults to 1.9.4 and 1.13.0, respectively.

## output-path

The filename to write the HTML to. Defaults to 'map-leaflet-tmp.html'.

## other attributes

Other attributes that are passed on to the javascript constructor include: `preferCanvas`, `attributionControl`, `zoomControl`, `closePopupOnClick`, `boxZoom`, `doubleClickZoom`, `dragging`, `zoomSnap`, `zoomDelta`, `trackResize`, `inertia`, `inertiaDeceleration`, `inertiaMaxSpeed`, `easeLinearity`, `worldCopyJump`, `maxBoundsViscosity`, `keyboard`, `keyboardPanDelta`, `scrollWheelZoom`, `wheelDebounceTime`, `wheelPxPerZoomLevel`, `tapHold`, `tapTolerance`, `touchZoom`, `bounceAtZoomLimits`, `crs`, `minZoom`, `maxZoom`, `maxBounds`, `renderer`, `zoomAnimation`, `zoomAnimationThreshold`, `fadeAnimation`, `markerZoomAnimation`, `transform3DLimit`.

# METHODS

## new

```
my $map = Map::Leaflet.new;
my $map = Map::Leaflet.new(
    center => { :lat(40.7128), :lon(-74.0060) },
    zoom => 13
);

```

Constructor. If no center is specified, then bounds are computed, and the starting view will have a zoom level and extents that fit all of the layers that have been added. See `ATTRIBUTES` for more options.

## add-marker

```
$map.add-marker: { :lat(40.7128), :lon(-74.0060) }, "New York City";
$map.add-marker: 40.7128, -74.0060, "New York City";
$map.add-marker: [40.7128, -74.0060], div => "You are here";

```

Add a marker. The first argument is a hash with `lat` and `lon` keys, and the second argument is an optional popup text. Or the first two arguments can be numeric for the lat + lon. Or they can be an array of two numbers. If a `div` option is provided, it will be used as the `html` option for a `create-div-icon` call, and an `icon` option will be added to the marker.

See `create-marker` below for a more complete way to create markers. Returns a `Map::Leaflet::Marker` object.

## create-div-icon

```
my $div-icon = $map.create-div-icon(html => '<b>New York City</b>');
my $div-icon = $map.create-div-icon: html => '<b>Paris</b>', iconSize => 'auto', className => 'mlraku-div-icon';

```

Create a divIcon. Accepts all of the leaflet.js options. See <https://leafletjs.com/reference.html#divicon>. Defaults to auto-sizing, a yellow background, and a black border, and a class of 'mlraku-div-icon'.

Also accepts a `name` option, which is used to name the icon in the javascript (defaults to an auto-generated name).

Returns a `Map::Leaflet::DivIcon` object.

## create-icon

```
my $icon = $map.create-icon(iconUrl => 'https://leafletjs.com/examples/custom-icons/leaf-green.png');
my $icon = $map.create-icon: iconUrl => 'https://leafletjs.com/examples/custom-icons/leaf-green.png', iconSize => '[38, 95]';

```

Create an icon. Accepts all of the leaflet.js options. See <https://leafletjs.com/reference.html#icon>. Note that the iconSize, iconAnchor, popupAnchor, and tooltipAnchor are all `PointStr` objects, which can be either a string of the form "[x, y]" or the string "auto".

## create-marker

```
$map.create-marker(latlng => [ $lat, $lon ], options => %( icon => $icon ));
$map.create-marker: latlng => [ $lat, $lon ], options => %( title => 'New York City', popup-text => 'The Big Apple' );

```

Create a marker. Accepts all of the leaflet.js options. See <https://leafletjs.com/reference.html#marker>. Also accepts popup-text as an option to generate a popup that is bound to the marker.

Defaults to False values for autoPan and autoPanFocus.

Returns a new `Map::Leaflet::Marker`.

## add-geojson

```
$map.add-geojson($geojson, $style);
$map.add-geojson(q:to/GEOJSON/);
{
  "type": "Feature",
  "geometry": {
    "type": "LineString",
    "coordinates": [
      [-74.0060, 40.7128],
      [-73.9851, 40.7589],
      [-73.9815, 40.7267],
      [-74.0060, 40.7128]
    ]
  }
}
GEOJSON
$map.add-geojson(
  %( :type<Feature>, :geometry(
    %( :type<LineString>, :coordinates(
      [
        [-74.0060, 40.7128],
        [-73.9851, 40.7589],
        [-73.9815, 40.7267],
        [-74.0060, 40.7128]
      ]
    ))
  )),
  style => { :color<red> }
);

```

Add a GeoJSON layer. `$geojson` can be a string or a hash. `$style` is optional and can also be a string or a hash.

## add-circle, create-circle

```
my $circle = $map.create-circle(
    center => [40.7128, -74.0060],
    radius => 500, # meters
    color => 'red',
    fillColor => 'red',
    fillOpacity => 0.5,
);

$map.add-circle( 40.7128, -74.0060, 500, { color => 'red' } );

```

Create a circle. Accepts all of the leaflet.js options. See <https://leafletjs.com/reference.html#circle>. Returns a new `Map::Leaflet::Circle`.

## add-rectangle, create-rectangle

```
$map.add-rectangle(40.7128, -74.0060, 40.7589, -73.9851, color => 'red');
$map.add-rectangle([40.7128, -74.0060, 40.7589, -73.9851], color => 'red');
$map.add-rectangle([ [40.7128, -74.0060], [40.7589, -73.9851]], color => 'red');

my $rectangle = $map.create-rectangle(
    bounds => [[40.7128, -74.0060], [40.7589, -73.9851]],
    color => 'red',
    fillColor => 'red',
    fillOpacity => 0.5,
);

```

Create a rectangle. The bounds can be specified either as four separate coordinates (lat1, lon1, lat2, lon2) or as an array of four numbers. Accepts all of the leaflet.js options. See <https://leafletjs.com/reference.html#rectangle>. Returns a new `Map::Leaflet::Rectangle`.

## add-polygon, create-polygon

```
my $polygon = $map.create-polygon(
    latlngs => [
        [40.7128, -74.0060],
        [40.7589, -73.9851],
        [40.7267, -73.9815]
    ],
    color => 'blue',
    fillColor => 'blue',
    fillOpacity => 0.3,
);

$map.add-polygon(latlngs => [[40.7128, -74.0060], [40.7589, -73.9851], [40.7267, -73.9815]]);

```

Create a polygon. The `latlngs` parameter is required and should be an array of coordinate pairs. Accepts all of the leaflet.js options. See <https://leafletjs.com/reference.html#polygon>. Returns a new `Map::Leaflet::Polygon`.

## add-polyline, create-polyline

```
my $polyline = $map.create-polyline(
    latlngs => [
        [40.7128, -74.0060],
        [40.7589, -73.9851]
    ],
    color => 'red',
    weight => 3,
);

$map.add-polyline(latlngs => [[40.7128, -74.0060], [40.7589, -73.9851]]);

```

Create a polyline. The `latlngs` parameter is required and should be an array of coordinate pairs. Accepts all of the leaflet.js options. See <https://leafletjs.com/reference.html#polyline>. Returns a new `Map::Leaflet::Polyline`.

## add-icons, add-markers

These exist if you create icons or markers without using the `create-*` methods. They will add the objects to the map. For examples, see `Map::Leaflet::Icon`

## render

```
spurt "map.html", $map.render;

```

Generate a complete HTML page for the map (including html, head, body, etc.). Returns a string.

## show

```
$map.show;

```

Generate the HTML, write it to <$.output-path>, and open a browser to view it.

## write

```
$map.write;

```

Generate the HTML and write it to <$.output-path>. Returns true if a new file was created, false if the file already existed and was overwritten.

# SEE ALSO

<https://leafletjs.com/>

# AUTHOR

Brian Duggan


## dist_github-erickjordan-Parse-STDF.md
# Parse::STDF - Module for parsing files in Standard Test Data Format

Standard Test Data Format (STDF) is a widely used standard file format for semiconductor test information.
It is a commonly used format produced by automatic test equipment (ATE) platforms from companies such as
LTX-Credence, Roos Instruments, Teradyne, Advantest, and others.

A STDF file is compacted into a binary format according to a well defined specification originally designed by
Teradyne. The record layouts, field definitions, and sizes are all described within the specification. Over the
years, parser tools have been developed to decode this binary format in several scripting languages, but as
of yet nothing has been released for Perl6.

Parse::STDF is a first attempt. It is an object oriented module containing methods which invoke APIs of
an underlying C library called **libstdf** (see <http://freestdf.sourceforge.net/>). **libstdf** performs
the grunt work of reading and parsing binary data into STDF records represented as C-structs. These
structs are in turn referenced as Perl6 class objects.

## SYNOPSIS

```
use Parse::STDF;

try
{
  my $s = Parse::STDF.new( stdf => $stdf );
  while $s.get_record
  {
    given ( $s.recname )
    {
      when "MIR"
      {
        my $mir = $s.mir;
        printf("Started At: %s\n", $mir.START_T.ctime);
        printf("Station Number: %d\n", $mir.STAT_NUM);
        printf("Station Mode: %s\n", $mir.MODE_COD.chr);
        printf("Retst_Code: %s\n", $mir.RTST_COD.chr);
        printf("Lot: %s\n", $mir.LOT_ID.cnstr);
        printf("Part Type: %s\n", $mir.PART_TYP.cnstr);
        printf("Node Name: %s\n", $mir.NODE_NAM.cnstr);
        printf("Tester Type: %s\n", $mir.TSTR_TYP.cnstr);
        printf("Program: %s\n", $mir.JOB_NAM.cnstr);
        printf("Version: %s\n", $mir.JOB_REV.cnstr);
        printf("Sublot: %s\n", $mir.SBLOT_ID.cnstr);
        printf("Operator: %s\n", $mir.OPER_NAM.cnstr);
        printf("Executive: %s\n", $mir.EXEC_TYP.cnstr);
        printf("Test Code: %s\n", $mir.TEST_COD.cnstr);
        printf("Test Temperature: %s\n", $mir.TST_TEMP.cnstr);
        printf("Package Type: %s\n", $mir.PKG_TYP.cnstr);
        printf("Facility ID: %s\n", $mir.FACIL_ID.cnstr);
        printf("Design Revision: %s\n", $mir.DSGN_REV.cnstr);
        printf("Flow ID: %s\n", $mir.FLOW_ID.cnstr);
        last;
      }
      default {}
    }
  }
  CATCH
  {
    when X::Parse::STDF { say $_.message; }
    default { say $_; }
  }
}

```

## INSTALLATION

Since Parse::STDF uses **libstdf**, 'libstdf.so' must be in your library path (e.g. /usr/local/lib).
To install **libstdf** on Ubuntu for example, use the following commands:

```
$ wget https://sourceforge.net/projects/freestdf/files/libstdf/libstdf-0.4.tar.bz2
$ bunzip2 libstdf-0.4.tar.bz2
$ tar -xvf libstdf-0.4.tar
$ cd libstdf-0.4
$ ./configure --disable-warn-untested
$ make
$ sudo make install
$ sudo ldconfig

```

Using zef (Rakudo module management tool) install:

```
$ zef install Parse::STDF

```

## TESTED PLATFORMS

The following platforms have been tested:

* RHEL Linux 6.x (x84\_64)
* Ubuntu 16.04 LTS (x86\_64)

[![Build Status](https://travis-ci.org/erickjordan/perl6-Parse-STDF.svg?branch=master)](https://travis-ci.org/erickjordan/perl6-Parse-STDF)

## EXAMPLES

Have a look at the examples. There are several scripts that demonstrate how to access the underlying objects and their attributes.
In particular, **dump\_records\_to\_ascii.p6** does a fair job of visiting each Parse::STDF object class.

## NativeCall

Parse::STDF uses NativeCall to interface with **libstdf**. Its easy to use, a natural fit and the next best
thing since sliced cheese. No need for ::XS, SWIG (or other bridging software) to interface a C library with Perl.
NativeCall makes installation of Parse::STDF simple and straightforward. There are only two things required
to get Parse::STDF up and running. Thing one; install **libstdf**. Thing two; install Parse::STDF.

The appeal for using **libstdf** is in its representation of STDF records using C-structs. These structs
are highly reusable and provide a solid foundation to quickly and easily build an application specific parser.
For example, a parser to extract token/value pairs from DTR records to insert rows into a data base table.

NativeCall represents C-structs nicely as Perl6 class objects. This is accomplished by declaring a Perl6 class
using the **repr** trait. See detail documenation here <https://doc.perl6.org/language/nativecall>. In addition
to C-structs NativeCall also represents pointer types which is critical for navigating the various APIs and
structs employed by **libstdf**. These powerful features (and others) make it possible to extend Perl seamlessly
without having to write customized C code.

### NativeCast

Navigating objects of **libstdf** requires a fair amount of C type casting. Following example was taken from
**libstdf/examples/dump\_records\_to\_ascii.c**:

```
case REC_DTR: {
  rec_dtr *dtr = (rec_dtr*)rec;
  print_str("TEXT_DAT", dtr->TEXT_DAT);
  break;
}

```

Here, `rec` is a pointer to C-struct called `rec_unknown`. It is later type casted as a `rec_dtr` type. To mimic
this behavior in Perl6 NativeCall provides an API called `nativecast` which effectively performs the same task as a C
type cast. The above can be written as the following in perl6:

```
nativecast(Pointer[rec_dtr], Pointer[rec]);

```

`nativecast` along with some other perl6 tricks made available by NaticeCall makes it possible to navigate **libstdf**
objects just as if it were written in C.

## SEE ALSO

For an intro to the Standard Test Data Format (along with references to detailed documentation)
see <http://en.wikipedia.org/wiki/Standard_Test_Data_Format>.

## AUTHOR

Erick F. Jordan [ejordan@cpan.org](mailto:ejordan@cpan.org)


## dist_cpan-JDV-Data-Selector.md
```
NAME
    Data::Selector - data selection dsl parser and applicator

INSTALLATION
    To install this module type the following:

    panda install Data::Selector

SEE ALSO
    See the individual module documentation for more information.

```


## mode.md
mode

Combined from primary sources listed below.

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

See primary documentation
[in context](/type/IO/Special#method_mode)
for **method mode**.

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

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

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

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

Return an [`IntStr`](/type/IntStr) object representing the POSIX permissions of a file. The [`Str`](/type/Str) part of the result is the octal representation of the file permission, like the form accepted by the `chmod(1)` utility.

```raku
say ~"path/to/file".IO.mode;  # e.g. '0644'
say +"path/to/file".IO.mode;  # e.g. 420, where sprintf('%04o', 420) eq '0644'

```

The result of this can be used in the other methods that take a mode as an argument.

```raku
"path/to/file1".IO.chmod("path/to/file2".IO.mode);  # will change the
                                                    # permissions of file1
                                                    # to be the same as file2

```

# [In X::IO::Mkdir](#___top "go to top of document")[§](#(X::IO::Mkdir)_method_mode "direct link")

See primary documentation
[in context](/type/X/IO/Mkdir#method_mode)
for **method mode**.

Returns the permissions mask of the failed [mkdir](/routine/mkdir) operation as an [`Int`](/type/Int).