txt
stringlengths 202
72.4k
|
---|
### ----------------------------------------------------
### -- roundrobin-slip
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: META6.json
### ----------------------------------------------------
{
"auth": "zef:lizmat",
"authors": [
"Elizabeth Mattijsen"
],
"build-depends": [
],
"depends": [
],
"description": "Provide roundrobin(:slip) for older Rakus",
"license": "Artistic-2.0",
"name": "roundrobin-slip",
"perl": "6.d",
"provides": {
"roundrobin-slip": "lib/roundrobin-slip.rakumod"
},
"resources": [
],
"source-url": "https://github.com/lizmat/roundrobin-slip.git",
"tags": [
"ROUNDROBIN"
],
"test-depends": [
],
"version": "0.0.3"
}
|
### ----------------------------------------------------
### -- roundrobin-slip
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: LICENSE
### ----------------------------------------------------
The Artistic License 2.0
Copyright (c) 2000-2006, The Perl Foundation.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
This license establishes the terms under which a given free software
Package may be copied, modified, distributed, and/or redistributed.
The intent is that the Copyright Holder maintains some artistic
control over the development of that Package while still keeping the
Package available as open source and free software.
You are always permitted to make arrangements wholly outside of this
license directly with the Copyright Holder of a given Package. If the
terms of this license do not permit the full use that you propose to
make of the Package, you should contact the Copyright Holder and seek
a different licensing arrangement.
Definitions
"Copyright Holder" means the individual(s) or organization(s)
named in the copyright notice for the entire Package.
"Contributor" means any party that has contributed code or other
material to the Package, in accordance with the Copyright Holder's
procedures.
"You" and "your" means any person who would like to copy,
distribute, or modify the Package.
"Package" means the collection of files distributed by the
Copyright Holder, and derivatives of that collection and/or of
those files. A given Package may consist of either the Standard
Version, or a Modified Version.
"Distribute" means providing a copy of the Package or making it
accessible to anyone else, or in the case of a company or
organization, to others outside of your company or organization.
"Distributor Fee" means any fee that you charge for Distributing
this Package or providing support for this Package to another
party. It does not mean licensing fees.
"Standard Version" refers to the Package if it has not been
modified, or has been modified only in ways explicitly requested
by the Copyright Holder.
"Modified Version" means the Package, if it has been changed, and
such changes were not explicitly requested by the Copyright
Holder.
"Original License" means this Artistic License as Distributed with
the Standard Version of the Package, in its current version or as
it may be modified by The Perl Foundation in the future.
"Source" form means the source code, documentation source, and
configuration files for the Package.
"Compiled" form means the compiled bytecode, object code, binary,
or any other form resulting from mechanical transformation or
translation of the Source form.
Permission for Use and Modification Without Distribution
(1) You are permitted to use the Standard Version and create and use
Modified Versions for any purpose without restriction, provided that
you do not Distribute the Modified Version.
Permissions for Redistribution of the Standard Version
(2) You may Distribute verbatim copies of the Source form of the
Standard Version of this Package in any medium without restriction,
either gratis or for a Distributor Fee, provided that you duplicate
all of the original copyright notices and associated disclaimers. At
your discretion, such verbatim copies may or may not include a
Compiled form of the Package.
(3) You may apply any bug fixes, portability changes, and other
modifications made available from the Copyright Holder. The resulting
Package will still be considered the Standard Version, and as such
will be subject to the Original License.
Distribution of Modified Versions of the Package as Source
(4) You may Distribute your Modified Version as Source (either gratis
or for a Distributor Fee, and with or without a Compiled form of the
Modified Version) provided that you clearly document how it differs
from the Standard Version, including, but not limited to, documenting
any non-standard features, executables, or modules, and provided that
you do at least ONE of the following:
(a) make the Modified Version available to the Copyright Holder
of the Standard Version, under the Original License, so that the
Copyright Holder may include your modifications in the Standard
Version.
(b) ensure that installation of your Modified Version does not
prevent the user installing or running the Standard Version. In
addition, the Modified Version must bear a name that is different
from the name of the Standard Version.
(c) allow anyone who receives a copy of the Modified Version to
make the Source form of the Modified Version available to others
under
(i) the Original License or
(ii) a license that permits the licensee to freely copy,
modify and redistribute the Modified Version using the same
licensing terms that apply to the copy that the licensee
received, and requires that the Source form of the Modified
Version, and of any works derived from it, be made freely
available in that license fees are prohibited but Distributor
Fees are allowed.
Distribution of Compiled Forms of the Standard Version
or Modified Versions without the Source
(5) You may Distribute Compiled forms of the Standard Version without
the Source, provided that you include complete instructions on how to
get the Source of the Standard Version. Such instructions must be
valid at the time of your distribution. If these instructions, at any
time while you are carrying out such distribution, become invalid, you
must provide new instructions on demand or cease further distribution.
If you provide valid instructions or cease distribution within thirty
days after you become aware that the instructions are invalid, then
you do not forfeit any of your rights under this license.
(6) You may Distribute a Modified Version in Compiled form without
the Source, provided that you comply with Section 4 with respect to
the Source of the Modified Version.
Aggregating or Linking the Package
(7) You may aggregate the Package (either the Standard Version or
Modified Version) with other packages and Distribute the resulting
aggregation provided that you do not charge a licensing fee for the
Package. Distributor Fees are permitted, and licensing fees for other
components in the aggregation are permitted. The terms of this license
apply to the use and Distribution of the Standard or Modified Versions
as included in the aggregation.
(8) You are permitted to link Modified and Standard Versions with
other works, to embed the Package in a larger work of your own, or to
build stand-alone binary or bytecode versions of applications that
include the Package, and Distribute the result without restriction,
provided the result does not expose a direct interface to the Package.
Items That are Not Considered Part of a Modified Version
(9) Works (including, but not limited to, modules and scripts) that
merely extend or make use of the Package, do not, by themselves, cause
the Package to be a Modified Version. In addition, such works are not
considered parts of the Package itself, and are not subject to the
terms of this license.
General Provisions
(10) Any use, modification, and distribution of the Standard or
Modified Versions is governed by this Artistic License. By using,
modifying or distributing the Package, you accept this license. Do not
use, modify, or distribute the Package, if you do not accept this
license.
(11) If your Modified Version has been derived from a Modified
Version made by someone other than you, you are nevertheless required
to ensure that your Modified Version complies with the requirements of
this license.
(12) This license does not grant you the right to use any trademark,
service mark, tradename, or logo of the Copyright Holder.
(13) This license includes the non-exclusive, worldwide,
free-of-charge patent license to make, have made, use, offer to sell,
sell, import and otherwise transfer the Package with respect to any
patent claims licensable by the Copyright Holder that are necessarily
infringed by the Package. If you institute patent litigation
(including a cross-claim or counterclaim) against any party alleging
that the Package constitutes direct or contributory patent
infringement, then this Artistic License to you shall terminate on the
date that such litigation is filed.
(14) Disclaimer of Warranty:
THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL
LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
### ----------------------------------------------------
### -- roundrobin-slip
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: README.md
### ----------------------------------------------------
[](https://github.com/lizmat/roundrobin-slip/actions) [](https://github.com/lizmat/roundrobin-slip/actions) [](https://github.com/lizmat/roundrobin-slip/actions)
NAME
====
roundrobin-slip - Provide roundrobin(:slip) for older Rakus
SYNOPSIS
========
```raku
use roundrobin-slip;
.say for roundrobin((1,2), (3,4)); # (1 3)(2 4)
.say for roundrobin((1,2), (3,4), :slip); # 1324
```
DESCRIPTION
===========
`roundrobin-slip` is a distribution that provides an extra candidate for the [roundrobin](https://docs.raku.org/routine/roundrobin) function that will automatically [slip](https://docs.raku.org/routine/slip) all values that are produced.
AUTHOR
======
Elizabeth Mattijsen <[email protected]>
Source can be located at: https://github.com/lizmat/roundrobin-slip . Comments and Pull Requests are welcome.
If you like this module, or what I’m doing more generally, committing to a [small sponsorship](https://github.com/sponsors/lizmat/) would mean a great deal to me!
COPYRIGHT AND LICENSE
=====================
Copyright 2021, 2024, 2025 Elizabeth Mattijsen
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
|
### ----------------------------------------------------
### -- roundrobin-slip
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: dist.ini
### ----------------------------------------------------
name = roundrobin-slip
[ReadmeFromPod]
; enable = false
filename = doc/roundrobin-slip.rakudoc
[UploadToZef]
[PruneFiles]
; match = ^ 'xt/'
[Badges]
provider = github-actions/linux.yml
provider = github-actions/macos.yml
provider = github-actions/windows.yml
|
### ----------------------------------------------------
### -- roundrobin-slip
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: t/01-basic.rakutest
### ----------------------------------------------------
use Test;
use roundrobin-slip;
my @tests = (
\( ), ( ), ( ), 'empty roundrobin',
\( (1,2), (3,4) ), ((1,3),(2,4)), (1,3,2,4), 'two equally sized lists',
\( (1,2), (3,) ), ((1,3),(2,) ), (1,3,2), 'two unequally sized lists',
\( (1,2), () ), ((1,), (2,) ), (1,2), 'one empty list',
);
plan @tests / 2;
for @tests -> \signature, \normal, \slipped, $message {
is-deeply roundrobin(|signature), normal, $message;
is-deeply roundrobin(|signature, :slip), slipped, "$message with :slip";
}
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- roundrobin-slip
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: xt/coverage.rakutest
### ----------------------------------------------------
use Test::Coverage;
plan 2;
todo "needs more tests";
coverage-at-least 75;
todo "needs more tests";
uncovered-at-most 1;
source-with-coverage;
report;
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- roundrobin-slip
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: lib/roundrobin-slip.rakumod
### ----------------------------------------------------
use nqp; # intended to also go in core
my $empty := nqp::list; # for removing elements with nqp::splice
# Return an iterator that will slip all values of the given iterables
# roundrobinly. Basically the functionality of roundrobin(@a,@b, :slip)
my class RoundrobinIterablesSlipped does Iterator {
has $!iters;
has $.is-lazy;
has int $!i;
method !SET-SELF(\iterables) {
my $iterables := nqp::getattr(iterables,List,'$!reified');
my int $elems = nqp::elems($iterables);
$!iters := nqp::setelems(nqp::list,$elems);
$!is-lazy := False;
my int $i = -1;
nqp::while(
nqp::islt_i(($i = nqp::add_i($i,1)),$elems),
nqp::bindpos($!iters,$i,
nqp::if(
nqp::iscont(my $elem := nqp::atpos($iterables,$i)),
Rakudo::Iterator.OneValue($elem),
nqp::stmts(
nqp::if($elem.is-lazy,($!is-lazy := True)),
$elem.iterator
)
)
)
);
self
}
method new(\iterables) { nqp::create(self)!SET-SELF(iterables) }
method pull-one() {
nqp::while(
nqp::islt_i($!i,nqp::elems($!iters))
&& nqp::eqaddr(
(my $pulled := nqp::atpos($!iters,$!i).pull-one),
IterationEnd
),
nqp::stmts(
nqp::splice($!iters,$empty,$!i,1), # remove exhausted
nqp::if( # check at same index
nqp::isge_i($!i,nqp::elems($!iters)), # unless it was last
($!i = 0)
)
)
);
$!i = 0 if nqp::isge_i(++$!i,nqp::elems($!iters));
$pulled
}
}
multi sub roundrobin(+lol, :$slip!) is export {
Seq.new: nqp::isgt_i(lol.elems,0) # reifies
?? RoundrobinIterablesSlipped.new(lol)
!! Rakudo::Iterator.Empty
}
sub EXPORT() {
(try &CORE::roundrobin(1, :slip))
?? Map.new # already in core
!! Map.new( ('&roundrobin' => &roundrobin) )
}
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- shorten-sub-commands
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: META6.json
### ----------------------------------------------------
{
"auth": "zef:lizmat",
"authors": [
"Elizabeth Mattijsen"
],
"build-depends": [
],
"depends": [
"as-cli-arguments:ver<0.0.8+>:auth<zef:lizmat>"
],
"description": "allow partial specification of sub-commands",
"license": "Artistic-2.0",
"name": "shorten-sub-commands",
"perl": "6.d",
"provides": {
"shorten-sub-commands": "lib/shorten-sub-commands.rakumod"
},
"resources": [
],
"source-url": "https://github.com/lizmat/shorten-sub-commands.git",
"tags": [
"CLI",
"MAIN"
],
"test-depends": [
],
"version": "0.0.7"
}
|
### ----------------------------------------------------
### -- shorten-sub-commands
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: LICENSE
### ----------------------------------------------------
The Artistic License 2.0
Copyright (c) 2000-2006, The Perl Foundation.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
This license establishes the terms under which a given free software
Package may be copied, modified, distributed, and/or redistributed.
The intent is that the Copyright Holder maintains some artistic
control over the development of that Package while still keeping the
Package available as open source and free software.
You are always permitted to make arrangements wholly outside of this
license directly with the Copyright Holder of a given Package. If the
terms of this license do not permit the full use that you propose to
make of the Package, you should contact the Copyright Holder and seek
a different licensing arrangement.
Definitions
"Copyright Holder" means the individual(s) or organization(s)
named in the copyright notice for the entire Package.
"Contributor" means any party that has contributed code or other
material to the Package, in accordance with the Copyright Holder's
procedures.
"You" and "your" means any person who would like to copy,
distribute, or modify the Package.
"Package" means the collection of files distributed by the
Copyright Holder, and derivatives of that collection and/or of
those files. A given Package may consist of either the Standard
Version, or a Modified Version.
"Distribute" means providing a copy of the Package or making it
accessible to anyone else, or in the case of a company or
organization, to others outside of your company or organization.
"Distributor Fee" means any fee that you charge for Distributing
this Package or providing support for this Package to another
party. It does not mean licensing fees.
"Standard Version" refers to the Package if it has not been
modified, or has been modified only in ways explicitly requested
by the Copyright Holder.
"Modified Version" means the Package, if it has been changed, and
such changes were not explicitly requested by the Copyright
Holder.
"Original License" means this Artistic License as Distributed with
the Standard Version of the Package, in its current version or as
it may be modified by The Perl Foundation in the future.
"Source" form means the source code, documentation source, and
configuration files for the Package.
"Compiled" form means the compiled bytecode, object code, binary,
or any other form resulting from mechanical transformation or
translation of the Source form.
Permission for Use and Modification Without Distribution
(1) You are permitted to use the Standard Version and create and use
Modified Versions for any purpose without restriction, provided that
you do not Distribute the Modified Version.
Permissions for Redistribution of the Standard Version
(2) You may Distribute verbatim copies of the Source form of the
Standard Version of this Package in any medium without restriction,
either gratis or for a Distributor Fee, provided that you duplicate
all of the original copyright notices and associated disclaimers. At
your discretion, such verbatim copies may or may not include a
Compiled form of the Package.
(3) You may apply any bug fixes, portability changes, and other
modifications made available from the Copyright Holder. The resulting
Package will still be considered the Standard Version, and as such
will be subject to the Original License.
Distribution of Modified Versions of the Package as Source
(4) You may Distribute your Modified Version as Source (either gratis
or for a Distributor Fee, and with or without a Compiled form of the
Modified Version) provided that you clearly document how it differs
from the Standard Version, including, but not limited to, documenting
any non-standard features, executables, or modules, and provided that
you do at least ONE of the following:
(a) make the Modified Version available to the Copyright Holder
of the Standard Version, under the Original License, so that the
Copyright Holder may include your modifications in the Standard
Version.
(b) ensure that installation of your Modified Version does not
prevent the user installing or running the Standard Version. In
addition, the Modified Version must bear a name that is different
from the name of the Standard Version.
(c) allow anyone who receives a copy of the Modified Version to
make the Source form of the Modified Version available to others
under
(i) the Original License or
(ii) a license that permits the licensee to freely copy,
modify and redistribute the Modified Version using the same
licensing terms that apply to the copy that the licensee
received, and requires that the Source form of the Modified
Version, and of any works derived from it, be made freely
available in that license fees are prohibited but Distributor
Fees are allowed.
Distribution of Compiled Forms of the Standard Version
or Modified Versions without the Source
(5) You may Distribute Compiled forms of the Standard Version without
the Source, provided that you include complete instructions on how to
get the Source of the Standard Version. Such instructions must be
valid at the time of your distribution. If these instructions, at any
time while you are carrying out such distribution, become invalid, you
must provide new instructions on demand or cease further distribution.
If you provide valid instructions or cease distribution within thirty
days after you become aware that the instructions are invalid, then
you do not forfeit any of your rights under this license.
(6) You may Distribute a Modified Version in Compiled form without
the Source, provided that you comply with Section 4 with respect to
the Source of the Modified Version.
Aggregating or Linking the Package
(7) You may aggregate the Package (either the Standard Version or
Modified Version) with other packages and Distribute the resulting
aggregation provided that you do not charge a licensing fee for the
Package. Distributor Fees are permitted, and licensing fees for other
components in the aggregation are permitted. The terms of this license
apply to the use and Distribution of the Standard or Modified Versions
as included in the aggregation.
(8) You are permitted to link Modified and Standard Versions with
other works, to embed the Package in a larger work of your own, or to
build stand-alone binary or bytecode versions of applications that
include the Package, and Distribute the result without restriction,
provided the result does not expose a direct interface to the Package.
Items That are Not Considered Part of a Modified Version
(9) Works (including, but not limited to, modules and scripts) that
merely extend or make use of the Package, do not, by themselves, cause
the Package to be a Modified Version. In addition, such works are not
considered parts of the Package itself, and are not subject to the
terms of this license.
General Provisions
(10) Any use, modification, and distribution of the Standard or
Modified Versions is governed by this Artistic License. By using,
modifying or distributing the Package, you accept this license. Do not
use, modify, or distribute the Package, if you do not accept this
license.
(11) If your Modified Version has been derived from a Modified
Version made by someone other than you, you are nevertheless required
to ensure that your Modified Version complies with the requirements of
this license.
(12) This license does not grant you the right to use any trademark,
service mark, tradename, or logo of the Copyright Holder.
(13) This license includes the non-exclusive, worldwide,
free-of-charge patent license to make, have made, use, offer to sell,
sell, import and otherwise transfer the Package with respect to any
patent claims licensable by the Copyright Holder that are necessarily
infringed by the Package. If you institute patent litigation
(including a cross-claim or counterclaim) against any party alleging
that the Package constitutes direct or contributory patent
infringement, then this Artistic License to you shall terminate on the
date that such litigation is filed.
(14) Disclaimer of Warranty:
THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL
LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
### ----------------------------------------------------
### -- shorten-sub-commands
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: README.md
### ----------------------------------------------------
[](https://github.com/lizmat/shorten-sub-commands/actions) [](https://github.com/lizmat/shorten-sub-commands/actions) [](https://github.com/lizmat/shorten-sub-commands/actions)
NAME
====
shorten-sub-commands - allow partial specification of sub-commands
SYNOPSIS
========
```raku
# in script "frobnicate"
multi sub MAIN("foozle") { say "foozle" }
multi sub MAIN("barabas") { say "barabas" }
multi sub MAIN("bazzie") { say "bazzie" }
use shorten::sub::commands &MAIN;
```
$ raku frobnicate foo
foozle
$ raku frobnicate ba
'ba' is ambiguous, matches: barabas bazzie
$ raku frobnicate bar
barabas
DESCRIPTION
===========
The `shorten::sub::commands` distribution provides a helper module intended to be used for command-line applications that have a sub-command structure (in which the first positional parameter indicates what needs to be done, and there is a separate candidate to handle execution of that command).
When used **after** all `MAIN` candidates have been defined, it will add another candidate that will allow to shorten the command names to be as short as possible (e.g. just "foo" in the example above, or even just "f" as there is only one candidate that starts with "f". Numeric subcommands are also supported, but they will be matched as strings (so `4` on the command line will match `42` in the signature).
Special care has been taken to ensure that re-dispatch doesn't devolve into an infinite loop.
AUTHOR
======
Elizabeth Mattijsen <[email protected]>
Source can be located at: https://github.com/lizmat/shorten-sub-commands . 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 2022, 2025 Elizabeth Mattijsen
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
|
### ----------------------------------------------------
### -- shorten-sub-commands
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: dist.ini
### ----------------------------------------------------
name = shorten-sub-commands
[ReadmeFromPod]
; enable = false
filename = doc/shorten-sub-commands.rakudoc
[UploadToZef]
[PruneFiles]
; match = ^ 'xt/'
[Badges]
provider = github-actions/linux.yml
provider = github-actions/macos.yml
provider = github-actions/windows.yml
|
### ----------------------------------------------------
### -- shorten-sub-commands
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: t/01-basic.rakutest
### ----------------------------------------------------
use Test;
plan 12;
my $raku := $*EXECUTABLE.absolute;
my $frobnicate := $*PROGRAM.sibling("frobnicate").absolute;
my $regurgitate := $*PROGRAM.sibling("regurgitate").absolute;
my $numicate := $*PROGRAM.sibling("numicate").absolute;
my sub test($script, $command, $expected) {
is (run $raku, '-I.', $script, $command, :merge).out.slurp(:close).chomp,
$expected,
"does $command give $expected?";
}
test $frobnicate, "foo", "foozle";
test $frobnicate, "bar", "barabas";
test $frobnicate, "baz", "bazzie";
test $frobnicate, "fnok", "'fnok' is not recognized as sub-command:\nKnown sub-commands: barabas bazzie foozle";
test $frobnicate, "ba", "'ba' is ambiguous, matches: barabas bazzie";
test $regurgitate, "s", "'s' recurses into 'search'";
test $regurgitate, "search", "'search' recurses";
test $numicate, "f", "foo";
test $numicate, "foo", "foo";
test $numicate, 4, 42;
test $numicate, 42, 42;
test $numicate, 423, "'423' is not recognized as sub-command:
Known sub-commands: 42 foo";
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- shorten-sub-commands
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: xt/coverage.rakutest
### ----------------------------------------------------
use Test::Coverage;
must-be-complete;
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- shorten-sub-commands
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: lib/shorten-sub-commands.rakumod
### ----------------------------------------------------
use as-cli-arguments:ver<0.0.8+>:auth<zef:lizmat>;
my sub meh($message) { exit note $message }
sub EXPORT(&target) {
die "Target &{&target.name} must be a multi"
unless &target.is_dispatcher;
my @sub-commands = &target.candidates.map({
if .signature.params -> @params {
my $sub-command := @params.head;
$sub-command.constraint_list.head
if !$sub-command.name
&& !$sub-command.named
&& $sub-command.type ~~ Str | Numeric
&& $sub-command.constraint_list == 1
}
}).sort.List;
&target.add_dispatchee: my sub (Str:D $command, |c) is hidden-from-USAGE {
meh("Must specify a sub-commmand") unless $command;
my @matches = @sub-commands.grep: -> $sub-command {
$sub-command.starts-with($command)
}
if @matches == 1 {
with $*RECURSIVE-SHORT-SUB-COMMAND -> $from {
my $params := as-cli-arguments c;
$params := " $params" if $params;
meh $command eq $from
?? "'$from$params' recurses"
!! "'$from$params' recurses into '$command'";
}
else {
my $*RECURSIVE-SHORT-SUB-COMMAND := $command;
target(@matches[0], |c);
}
}
else {
@matches
?? meh("'$command' is ambiguous, matches: @matches[]")
!! meh("'$command' is not recognized as sub-command:
Known sub-commands: @sub-commands[]")
}
}
Map.new
}
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- sigpipe
### -- Licenses: Artistic-2.0
### -- Authors: Leon Timmermans
### -- File: META6.json
### ----------------------------------------------------
{
"auth": "zef:leont",
"authors": [
"Leon Timmermans"
],
"build-depends": [
],
"depends": [
],
"description": "set up SIGPIPE correctly for CLI applications",
"license": "Artistic-2.0",
"name": "sigpipe",
"perl": "6.d",
"provides": {
"sigpipe": "lib/sigpipe.rakumod"
},
"resources": [
],
"source-url": "https://github.com/Leont/sigpipe.git",
"tags": [
],
"test-depends": [
],
"version": "0.0.3"
}
|
### ----------------------------------------------------
### -- sigpipe
### -- Licenses: Artistic-2.0
### -- Authors: Leon Timmermans
### -- File: LICENSE
### ----------------------------------------------------
The Artistic License 2.0
Copyright (c) 2000-2006, The Perl Foundation.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
This license establishes the terms under which a given free software
Package may be copied, modified, distributed, and/or redistributed.
The intent is that the Copyright Holder maintains some artistic
control over the development of that Package while still keeping the
Package available as open source and free software.
You are always permitted to make arrangements wholly outside of this
license directly with the Copyright Holder of a given Package. If the
terms of this license do not permit the full use that you propose to
make of the Package, you should contact the Copyright Holder and seek
a different licensing arrangement.
Definitions
"Copyright Holder" means the individual(s) or organization(s)
named in the copyright notice for the entire Package.
"Contributor" means any party that has contributed code or other
material to the Package, in accordance with the Copyright Holder's
procedures.
"You" and "your" means any person who would like to copy,
distribute, or modify the Package.
"Package" means the collection of files distributed by the
Copyright Holder, and derivatives of that collection and/or of
those files. A given Package may consist of either the Standard
Version, or a Modified Version.
"Distribute" means providing a copy of the Package or making it
accessible to anyone else, or in the case of a company or
organization, to others outside of your company or organization.
"Distributor Fee" means any fee that you charge for Distributing
this Package or providing support for this Package to another
party. It does not mean licensing fees.
"Standard Version" refers to the Package if it has not been
modified, or has been modified only in ways explicitly requested
by the Copyright Holder.
"Modified Version" means the Package, if it has been changed, and
such changes were not explicitly requested by the Copyright
Holder.
"Original License" means this Artistic License as Distributed with
the Standard Version of the Package, in its current version or as
it may be modified by The Perl Foundation in the future.
"Source" form means the source code, documentation source, and
configuration files for the Package.
"Compiled" form means the compiled bytecode, object code, binary,
or any other form resulting from mechanical transformation or
translation of the Source form.
Permission for Use and Modification Without Distribution
(1) You are permitted to use the Standard Version and create and use
Modified Versions for any purpose without restriction, provided that
you do not Distribute the Modified Version.
Permissions for Redistribution of the Standard Version
(2) You may Distribute verbatim copies of the Source form of the
Standard Version of this Package in any medium without restriction,
either gratis or for a Distributor Fee, provided that you duplicate
all of the original copyright notices and associated disclaimers. At
your discretion, such verbatim copies may or may not include a
Compiled form of the Package.
(3) You may apply any bug fixes, portability changes, and other
modifications made available from the Copyright Holder. The resulting
Package will still be considered the Standard Version, and as such
will be subject to the Original License.
Distribution of Modified Versions of the Package as Source
(4) You may Distribute your Modified Version as Source (either gratis
or for a Distributor Fee, and with or without a Compiled form of the
Modified Version) provided that you clearly document how it differs
from the Standard Version, including, but not limited to, documenting
any non-standard features, executables, or modules, and provided that
you do at least ONE of the following:
(a) make the Modified Version available to the Copyright Holder
of the Standard Version, under the Original License, so that the
Copyright Holder may include your modifications in the Standard
Version.
(b) ensure that installation of your Modified Version does not
prevent the user installing or running the Standard Version. In
addition, the Modified Version must bear a name that is different
from the name of the Standard Version.
(c) allow anyone who receives a copy of the Modified Version to
make the Source form of the Modified Version available to others
under
(i) the Original License or
(ii) a license that permits the licensee to freely copy,
modify and redistribute the Modified Version using the same
licensing terms that apply to the copy that the licensee
received, and requires that the Source form of the Modified
Version, and of any works derived from it, be made freely
available in that license fees are prohibited but Distributor
Fees are allowed.
Distribution of Compiled Forms of the Standard Version
or Modified Versions without the Source
(5) You may Distribute Compiled forms of the Standard Version without
the Source, provided that you include complete instructions on how to
get the Source of the Standard Version. Such instructions must be
valid at the time of your distribution. If these instructions, at any
time while you are carrying out such distribution, become invalid, you
must provide new instructions on demand or cease further distribution.
If you provide valid instructions or cease distribution within thirty
days after you become aware that the instructions are invalid, then
you do not forfeit any of your rights under this license.
(6) You may Distribute a Modified Version in Compiled form without
the Source, provided that you comply with Section 4 with respect to
the Source of the Modified Version.
Aggregating or Linking the Package
(7) You may aggregate the Package (either the Standard Version or
Modified Version) with other packages and Distribute the resulting
aggregation provided that you do not charge a licensing fee for the
Package. Distributor Fees are permitted, and licensing fees for other
components in the aggregation are permitted. The terms of this license
apply to the use and Distribution of the Standard or Modified Versions
as included in the aggregation.
(8) You are permitted to link Modified and Standard Versions with
other works, to embed the Package in a larger work of your own, or to
build stand-alone binary or bytecode versions of applications that
include the Package, and Distribute the result without restriction,
provided the result does not expose a direct interface to the Package.
Items That are Not Considered Part of a Modified Version
(9) Works (including, but not limited to, modules and scripts) that
merely extend or make use of the Package, do not, by themselves, cause
the Package to be a Modified Version. In addition, such works are not
considered parts of the Package itself, and are not subject to the
terms of this license.
General Provisions
(10) Any use, modification, and distribution of the Standard or
Modified Versions is governed by this Artistic License. By using,
modifying or distributing the Package, you accept this license. Do not
use, modify, or distribute the Package, if you do not accept this
license.
(11) If your Modified Version has been derived from a Modified
Version made by someone other than you, you are nevertheless required
to ensure that your Modified Version complies with the requirements of
this license.
(12) This license does not grant you the right to use any trademark,
service mark, tradename, or logo of the Copyright Holder.
(13) This license includes the non-exclusive, worldwide,
free-of-charge patent license to make, have made, use, offer to sell,
sell, import and otherwise transfer the Package with respect to any
patent claims licensable by the Copyright Holder that are necessarily
infringed by the Package. If you institute patent litigation
(including a cross-claim or counterclaim) against any party alleging
that the Package constitutes direct or contributory patent
infringement, then this Artistic License to you shall terminate on the
date that such litigation is filed.
(14) Disclaimer of Warranty:
THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL
LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
### ----------------------------------------------------
### -- sigpipe
### -- Licenses: Artistic-2.0
### -- Authors: Leon Timmermans
### -- File: README.md
### ----------------------------------------------------
[](https://github.com/Leont/sigpipe/actions)
NAME
====
sigpipe - set up SIGPIPE correctly for CLI applications
SYNOPSIS
========
```raku
use sigpipe;
```
DESCRIPTION
===========
Raku's default sigpipe handling does the sensible things for networking applications, but entirely the wrong thing for CLI applications. For example a program like `raku -e 'loop { say "y" }' | head` will output a long error message that is entirely useless for the end-user. This module will instead use the unix default: end the program immediately without any ceremony.
AUTHOR
======
Leon Timmermans <[email protected]>
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.
|
### ----------------------------------------------------
### -- sigpipe
### -- Licenses: Artistic-2.0
### -- Authors: Leon Timmermans
### -- File: dist.ini
### ----------------------------------------------------
name = sigpipe
[ReadmeFromPod]
; enable = false
filename = lib/sigpipe.rakumod
[UploadToZef]
[PruneFiles]
; match = ^ 'xt/'
[Badges]
provider = github-actions/test
|
### ----------------------------------------------------
### -- sigpipe
### -- Licenses: Artistic-2.0
### -- Authors: Leon Timmermans
### -- File: t/01-basic.rakutest
### ----------------------------------------------------
use Test;
use sigpipe;
pass "Keep CI happy until we have proper tests";
done-testing;
|
### ----------------------------------------------------
### -- sigpipe
### -- Licenses: Artistic-2.0
### -- Authors: Leon Timmermans
### -- File: lib/sigpipe.rakumod
### ----------------------------------------------------
unit package sigpipe;
use NativeCall;
my sub signal(int32 $signal, long $func) is native { * }
INIT {
# if signal or SIGPIPE doesn't exist this is a noop.
try signal(Signal.WHO<SIGPIPE>, 0);
}
=begin pod
=head1 NAME
sigpipe - set up SIGPIPE correctly for CLI applications
=head1 SYNOPSIS
=begin code :lang<raku>
use sigpipe;
=end code
=head1 DESCRIPTION
Raku's default sigpipe handling does the sensible things for networking applications, but entirely the wrong thing for CLI applications. For example a program like C<raku -e 'loop { say "y" }' | head> will output a long error message that is entirely useless for the end-user. This module will instead use the unix default: end the program immediately without any ceremony.
=head1 AUTHOR
Leon Timmermans <[email protected]>
=head1 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.
=end pod
|
### ----------------------------------------------------
### -- silently
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: META6.json
### ----------------------------------------------------
{
"auth": "zef:lizmat",
"authors": [
"Elizabeth Mattijsen"
],
"build-depends": [
],
"depends": [
"Trap:auth<zef:lizmat>:ver<0.0.1+>"
],
"description": "prevent any output from a block",
"license": "Artistic-2.0",
"name": "silently",
"perl": "6.c",
"provides": {
"silently": "lib/silently.rakumod"
},
"resources": [
],
"source-url": "https://github.com/lizmat/silently.git",
"tags": [
"OUTPUT"
],
"test-depends": [
],
"version": "0.0.7"
}
|
### ----------------------------------------------------
### -- silently
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: LICENSE
### ----------------------------------------------------
The Artistic License 2.0
Copyright (c) 2000-2006, The Perl Foundation.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
This license establishes the terms under which a given free software
Package may be copied, modified, distributed, and/or redistributed.
The intent is that the Copyright Holder maintains some artistic
control over the development of that Package while still keeping the
Package available as open source and free software.
You are always permitted to make arrangements wholly outside of this
license directly with the Copyright Holder of a given Package. If the
terms of this license do not permit the full use that you propose to
make of the Package, you should contact the Copyright Holder and seek
a different licensing arrangement.
Definitions
"Copyright Holder" means the individual(s) or organization(s)
named in the copyright notice for the entire Package.
"Contributor" means any party that has contributed code or other
material to the Package, in accordance with the Copyright Holder's
procedures.
"You" and "your" means any person who would like to copy,
distribute, or modify the Package.
"Package" means the collection of files distributed by the
Copyright Holder, and derivatives of that collection and/or of
those files. A given Package may consist of either the Standard
Version, or a Modified Version.
"Distribute" means providing a copy of the Package or making it
accessible to anyone else, or in the case of a company or
organization, to others outside of your company or organization.
"Distributor Fee" means any fee that you charge for Distributing
this Package or providing support for this Package to another
party. It does not mean licensing fees.
"Standard Version" refers to the Package if it has not been
modified, or has been modified only in ways explicitly requested
by the Copyright Holder.
"Modified Version" means the Package, if it has been changed, and
such changes were not explicitly requested by the Copyright
Holder.
"Original License" means this Artistic License as Distributed with
the Standard Version of the Package, in its current version or as
it may be modified by The Perl Foundation in the future.
"Source" form means the source code, documentation source, and
configuration files for the Package.
"Compiled" form means the compiled bytecode, object code, binary,
or any other form resulting from mechanical transformation or
translation of the Source form.
Permission for Use and Modification Without Distribution
(1) You are permitted to use the Standard Version and create and use
Modified Versions for any purpose without restriction, provided that
you do not Distribute the Modified Version.
Permissions for Redistribution of the Standard Version
(2) You may Distribute verbatim copies of the Source form of the
Standard Version of this Package in any medium without restriction,
either gratis or for a Distributor Fee, provided that you duplicate
all of the original copyright notices and associated disclaimers. At
your discretion, such verbatim copies may or may not include a
Compiled form of the Package.
(3) You may apply any bug fixes, portability changes, and other
modifications made available from the Copyright Holder. The resulting
Package will still be considered the Standard Version, and as such
will be subject to the Original License.
Distribution of Modified Versions of the Package as Source
(4) You may Distribute your Modified Version as Source (either gratis
or for a Distributor Fee, and with or without a Compiled form of the
Modified Version) provided that you clearly document how it differs
from the Standard Version, including, but not limited to, documenting
any non-standard features, executables, or modules, and provided that
you do at least ONE of the following:
(a) make the Modified Version available to the Copyright Holder
of the Standard Version, under the Original License, so that the
Copyright Holder may include your modifications in the Standard
Version.
(b) ensure that installation of your Modified Version does not
prevent the user installing or running the Standard Version. In
addition, the Modified Version must bear a name that is different
from the name of the Standard Version.
(c) allow anyone who receives a copy of the Modified Version to
make the Source form of the Modified Version available to others
under
(i) the Original License or
(ii) a license that permits the licensee to freely copy,
modify and redistribute the Modified Version using the same
licensing terms that apply to the copy that the licensee
received, and requires that the Source form of the Modified
Version, and of any works derived from it, be made freely
available in that license fees are prohibited but Distributor
Fees are allowed.
Distribution of Compiled Forms of the Standard Version
or Modified Versions without the Source
(5) You may Distribute Compiled forms of the Standard Version without
the Source, provided that you include complete instructions on how to
get the Source of the Standard Version. Such instructions must be
valid at the time of your distribution. If these instructions, at any
time while you are carrying out such distribution, become invalid, you
must provide new instructions on demand or cease further distribution.
If you provide valid instructions or cease distribution within thirty
days after you become aware that the instructions are invalid, then
you do not forfeit any of your rights under this license.
(6) You may Distribute a Modified Version in Compiled form without
the Source, provided that you comply with Section 4 with respect to
the Source of the Modified Version.
Aggregating or Linking the Package
(7) You may aggregate the Package (either the Standard Version or
Modified Version) with other packages and Distribute the resulting
aggregation provided that you do not charge a licensing fee for the
Package. Distributor Fees are permitted, and licensing fees for other
components in the aggregation are permitted. The terms of this license
apply to the use and Distribution of the Standard or Modified Versions
as included in the aggregation.
(8) You are permitted to link Modified and Standard Versions with
other works, to embed the Package in a larger work of your own, or to
build stand-alone binary or bytecode versions of applications that
include the Package, and Distribute the result without restriction,
provided the result does not expose a direct interface to the Package.
Items That are Not Considered Part of a Modified Version
(9) Works (including, but not limited to, modules and scripts) that
merely extend or make use of the Package, do not, by themselves, cause
the Package to be a Modified Version. In addition, such works are not
considered parts of the Package itself, and are not subject to the
terms of this license.
General Provisions
(10) Any use, modification, and distribution of the Standard or
Modified Versions is governed by this Artistic License. By using,
modifying or distributing the Package, you accept this license. Do not
use, modify, or distribute the Package, if you do not accept this
license.
(11) If your Modified Version has been derived from a Modified
Version made by someone other than you, you are nevertheless required
to ensure that your Modified Version complies with the requirements of
this license.
(12) This license does not grant you the right to use any trademark,
service mark, tradename, or logo of the Copyright Holder.
(13) This license includes the non-exclusive, worldwide,
free-of-charge patent license to make, have made, use, offer to sell,
sell, import and otherwise transfer the Package with respect to any
patent claims licensable by the Copyright Holder that are necessarily
infringed by the Package. If you institute patent litigation
(including a cross-claim or counterclaim) against any party alleging
that the Package constitutes direct or contributory patent
infringement, then this Artistic License to you shall terminate on the
date that such litigation is filed.
(14) Disclaimer of Warranty:
THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL
LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
### ----------------------------------------------------
### -- silently
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: README.md
### ----------------------------------------------------
[](https://github.com/lizmat/silently/actions) [](https://github.com/lizmat/silently/actions) [](https://github.com/lizmat/silently/actions)
NAME
====
silently - prevent any output from a block
SYNOPSIS
========
```raku
use silently;
```
DESCRIPTION
===========
silently is module that exports a single sub called `silently` that takes a block to execute. Inside that block, all textual output to `$*OUT` and `$*ERR` is prevented from actually being sent to STDOUT and STDERR.
Note that if you're only interested in surpressing output from warnings, you should use the `quietly` statement prefix.
SUBROUTINES
===========
silently
--------
```raku
silently { say "hello world" } # no output
my $captured = silently { note "tis wrong" }
if $captured.err -> $error {
say "something went wrong: $error";
}
```
The `silently` subroutine takes a block as a parameter, and runs that block catching all output to `$*OUT` and `$*ERR`.
If the output is actually needed for inspection: the subroutine returns an object that provides two methods: `out` and `err`, giving the captured output to `$*OUT` and `$*ERR` respectively.
AUTHOR
======
Elizabeth Mattijsen <[email protected]>
Source can be located at: https://github.com/lizmat/silently . 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 2020, 2021, 2022, 2025 Elizabeth Mattijsen
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
|
### ----------------------------------------------------
### -- silently
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: dist.ini
### ----------------------------------------------------
name = silently
[ReadmeFromPod]
; enable = false
filename = doc/silently.rakudoc
[PruneFiles]
; match = ^ 'xt/'
[Badges]
provider = github-actions/linux.yml
provider = github-actions/macos.yml
provider = github-actions/windows.yml
[UploadToZef]
|
### ----------------------------------------------------
### -- silently
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: t/01-basic.rakutest
### ----------------------------------------------------
use Test;
use silently;
plan 5;
my $out-pos = $*OUT.tell;
silently {
say "foo";
print "foo more";
printf "foo: %d", 42;
}
is $*OUT.tell, $out-pos, 'did nothing get output on STDOUT';
my $err-pos = $*ERR.tell;
silently {
note "bar";
warn "knock knock";
}
is $*ERR.tell, $err-pos, 'did nothing get output on STDERR';
my $captured = silently {
say "hello world";
note "shitty";
warn "bleh";
printf "zippodak: %d", 666;
}
is $captured.out.lines.join(chr(10)),
"hello world\nzippodak: 666",
'OUT captured ok';
ok $captured.err.contains('shitty'), 'ERR captured ok (1)';
ok $captured.err.contains('bleh'), 'ERR captured ok (2)';
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- silently
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: xt/coverage.rakutest
### ----------------------------------------------------
use Test::Coverage;
plan 2;
coverage-at-least 73;
uncovered-at-most 4;
source-with-coverage;
report;
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- silently
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: lib/silently.rakumod
### ----------------------------------------------------
use Trap:auth<zef:lizmat>:ver<0.0.1+>;
my class Captured {
has $!out;
has $!err;
method SET-SELF(\out, \err) {
out = $!out := Trap.new;
err = $!err := Trap.new;
self
}
method new(\out, \err) { self.CREATE.SET-SELF(out, err) }
method out(--> str) { $!out.text }
method err(--> str) { $!err.text }
}
sub silently(&code) is export {
my $captured := Captured.new(my $*OUT, my $*ERR);
&code();
$captured
}
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- snip
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: META6.json
### ----------------------------------------------------
{
"auth": "zef:lizmat",
"authors": [
"Elizabeth Mattijsen"
],
"build-depends": [
],
"depends": [
],
"description": "Provide functionality similar to Haskell's span",
"license": "Artistic-2.0",
"name": "snip",
"perl": "6.d",
"provides": {
"snip": "lib/snip.rakumod"
},
"resources": [
],
"source-url": "https://github.com/lizmat/snip.git",
"tags": [
"SPAN",
"SNIP"
],
"test-depends": [
],
"version": "0.0.2"
}
|
### ----------------------------------------------------
### -- snip
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: LICENSE
### ----------------------------------------------------
The Artistic License 2.0
Copyright (c) 2000-2006, The Perl Foundation.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
This license establishes the terms under which a given free software
Package may be copied, modified, distributed, and/or redistributed.
The intent is that the Copyright Holder maintains some artistic
control over the development of that Package while still keeping the
Package available as open source and free software.
You are always permitted to make arrangements wholly outside of this
license directly with the Copyright Holder of a given Package. If the
terms of this license do not permit the full use that you propose to
make of the Package, you should contact the Copyright Holder and seek
a different licensing arrangement.
Definitions
"Copyright Holder" means the individual(s) or organization(s)
named in the copyright notice for the entire Package.
"Contributor" means any party that has contributed code or other
material to the Package, in accordance with the Copyright Holder's
procedures.
"You" and "your" means any person who would like to copy,
distribute, or modify the Package.
"Package" means the collection of files distributed by the
Copyright Holder, and derivatives of that collection and/or of
those files. A given Package may consist of either the Standard
Version, or a Modified Version.
"Distribute" means providing a copy of the Package or making it
accessible to anyone else, or in the case of a company or
organization, to others outside of your company or organization.
"Distributor Fee" means any fee that you charge for Distributing
this Package or providing support for this Package to another
party. It does not mean licensing fees.
"Standard Version" refers to the Package if it has not been
modified, or has been modified only in ways explicitly requested
by the Copyright Holder.
"Modified Version" means the Package, if it has been changed, and
such changes were not explicitly requested by the Copyright
Holder.
"Original License" means this Artistic License as Distributed with
the Standard Version of the Package, in its current version or as
it may be modified by The Perl Foundation in the future.
"Source" form means the source code, documentation source, and
configuration files for the Package.
"Compiled" form means the compiled bytecode, object code, binary,
or any other form resulting from mechanical transformation or
translation of the Source form.
Permission for Use and Modification Without Distribution
(1) You are permitted to use the Standard Version and create and use
Modified Versions for any purpose without restriction, provided that
you do not Distribute the Modified Version.
Permissions for Redistribution of the Standard Version
(2) You may Distribute verbatim copies of the Source form of the
Standard Version of this Package in any medium without restriction,
either gratis or for a Distributor Fee, provided that you duplicate
all of the original copyright notices and associated disclaimers. At
your discretion, such verbatim copies may or may not include a
Compiled form of the Package.
(3) You may apply any bug fixes, portability changes, and other
modifications made available from the Copyright Holder. The resulting
Package will still be considered the Standard Version, and as such
will be subject to the Original License.
Distribution of Modified Versions of the Package as Source
(4) You may Distribute your Modified Version as Source (either gratis
or for a Distributor Fee, and with or without a Compiled form of the
Modified Version) provided that you clearly document how it differs
from the Standard Version, including, but not limited to, documenting
any non-standard features, executables, or modules, and provided that
you do at least ONE of the following:
(a) make the Modified Version available to the Copyright Holder
of the Standard Version, under the Original License, so that the
Copyright Holder may include your modifications in the Standard
Version.
(b) ensure that installation of your Modified Version does not
prevent the user installing or running the Standard Version. In
addition, the Modified Version must bear a name that is different
from the name of the Standard Version.
(c) allow anyone who receives a copy of the Modified Version to
make the Source form of the Modified Version available to others
under
(i) the Original License or
(ii) a license that permits the licensee to freely copy,
modify and redistribute the Modified Version using the same
licensing terms that apply to the copy that the licensee
received, and requires that the Source form of the Modified
Version, and of any works derived from it, be made freely
available in that license fees are prohibited but Distributor
Fees are allowed.
Distribution of Compiled Forms of the Standard Version
or Modified Versions without the Source
(5) You may Distribute Compiled forms of the Standard Version without
the Source, provided that you include complete instructions on how to
get the Source of the Standard Version. Such instructions must be
valid at the time of your distribution. If these instructions, at any
time while you are carrying out such distribution, become invalid, you
must provide new instructions on demand or cease further distribution.
If you provide valid instructions or cease distribution within thirty
days after you become aware that the instructions are invalid, then
you do not forfeit any of your rights under this license.
(6) You may Distribute a Modified Version in Compiled form without
the Source, provided that you comply with Section 4 with respect to
the Source of the Modified Version.
Aggregating or Linking the Package
(7) You may aggregate the Package (either the Standard Version or
Modified Version) with other packages and Distribute the resulting
aggregation provided that you do not charge a licensing fee for the
Package. Distributor Fees are permitted, and licensing fees for other
components in the aggregation are permitted. The terms of this license
apply to the use and Distribution of the Standard or Modified Versions
as included in the aggregation.
(8) You are permitted to link Modified and Standard Versions with
other works, to embed the Package in a larger work of your own, or to
build stand-alone binary or bytecode versions of applications that
include the Package, and Distribute the result without restriction,
provided the result does not expose a direct interface to the Package.
Items That are Not Considered Part of a Modified Version
(9) Works (including, but not limited to, modules and scripts) that
merely extend or make use of the Package, do not, by themselves, cause
the Package to be a Modified Version. In addition, such works are not
considered parts of the Package itself, and are not subject to the
terms of this license.
General Provisions
(10) Any use, modification, and distribution of the Standard or
Modified Versions is governed by this Artistic License. By using,
modifying or distributing the Package, you accept this license. Do not
use, modify, or distribute the Package, if you do not accept this
license.
(11) If your Modified Version has been derived from a Modified
Version made by someone other than you, you are nevertheless required
to ensure that your Modified Version complies with the requirements of
this license.
(12) This license does not grant you the right to use any trademark,
service mark, tradename, or logo of the Copyright Holder.
(13) This license includes the non-exclusive, worldwide,
free-of-charge patent license to make, have made, use, offer to sell,
sell, import and otherwise transfer the Package with respect to any
patent claims licensable by the Copyright Holder that are necessarily
infringed by the Package. If you institute patent litigation
(including a cross-claim or counterclaim) against any party alleging
that the Package constitutes direct or contributory patent
infringement, then this Artistic License to you shall terminate on the
date that such litigation is filed.
(14) Disclaimer of Warranty:
THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL
LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
### ----------------------------------------------------
### -- snip
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: README.md
### ----------------------------------------------------
[](https://github.com/lizmat/snip/actions) [](https://github.com/lizmat/snip/actions) [](https://github.com/lizmat/snip/actions)
NAME
====
snip - Provide functionality similar to Haskell's span
SYNOPSIS
========
```raku
use snip;
.say for snip * < 10, 2, 2, 2, 5, 5, 7, 13, 9, 6, 2, 20, 4;
# (2 2 2 5 5 7)
# (13 9 6 2 20 4)
.say for snip (* < 10, * < 20), 2, 2, 2, 5, 5, 7, 13, 9, 6, 2, 20, 4;
# (2 2 2 5 5 7)
# (13 9 6 2)
# (20 4)
.say for snip Int, 2, 2, 2, 5, 5, "a", "b", "c";
# (2 2 2 5 5)
# (a b c)
```
DESCRIPTION
===========
The `snip` distribution exports a single subroutine `snip` that mimics the functionality provided by [Haskell's span functionality](https://hackage.haskell.org/package/base-4.16.1.0/docs/Prelude.html#v:snip). But only if the core does not supply a `snip` subroutine already (which it may at some point in the future).
The `snip` subroutine takes a matcher much like `grep` does, which can be a `Callable` or any other object that can have the `ACCEPTS` method called on it. Different from the Haskell's `span` implementation, `snip` can take multiple matchers to snip the origin list in more than 2 parts.
AUTHOR
======
Elizabeth Mattijsen <[email protected]>
Source can be located at: https://github.com/lizmat/snip . 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 2022, 2024 Elizabeth Mattijsen
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
|
### ----------------------------------------------------
### -- snip
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: dist.ini
### ----------------------------------------------------
name = snip
[ReadmeFromPod]
; enabled = false
filename = lib/snip.rakumod
[UploadToZef]
[PruneFiles]
; match = ^ 'xt/'
[Badges]
provider = github-actions/linux.yml
provider = github-actions/macos.yml
provider = github-actions/windows.yml
|
### ----------------------------------------------------
### -- snip
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: t/01-basic.rakutest
### ----------------------------------------------------
use Test;
use snip;
plan 3;
is-deeply snip(* < 10, 2, 2, 2, 5, 5, 7, 13, 9, 6, 2, 20, 4),
((2,2,2,5,5,7), (13,9,6,2,20,4)),
'snip with a single Callable';
is-deeply snip( (* < 10, * < 20), 2, 2, 2, 5, 5, 7, 13, 9, 6, 2, 20, 4),
((2,2,2,5,5,7),(13,9,6,2),(20,4)),
'snip with two Callables';
is-deeply snip( Int, 2, 2, 2, 5, 5, "a", "b", "c"),
((2,2,2,5,5),<a b c>),
'snip with a type object';
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- snip
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: lib/snip.rakumod
### ----------------------------------------------------
use nqp; # intended to be part of Raku core
my class Snip does Iterator {
has $!tests;
has $!iterator;
has $!next;
method !SET-SELF(@tests, $iterator) {
$!tests := nqp::getattr(@tests,List,'$!reified');
$!iterator := $iterator;
$!next := $iterator.pull-one;
self
}
method new(@tests, $iterator) {
nqp::create(self)!SET-SELF(@tests, $iterator)
}
method pull-one() {
if nqp::eqaddr($!next,IterationEnd) {
IterationEnd
}
else {
my $buffer := nqp::create(IterationBuffer);
nqp::push($buffer,$!next);
my $iterator := $!iterator;
my $pulled;
if nqp::elems($!tests) {
my $test := nqp::shift($!tests);
nqp::until(
nqp::eqaddr(($pulled := $iterator.pull-one),IterationEnd)
|| nqp::isfalse($test.ACCEPTS($pulled)),
nqp::push($buffer,$pulled)
);
}
else {
nqp::until(
nqp::eqaddr(($pulled := $iterator.pull-one),IterationEnd),
nqp::push($buffer,$pulled)
);
}
$!next := $pulled;
$buffer.List
}
}
}
my proto sub snip($, |) {*}
my multi sub snip(\condition, +values) {
Seq.new: Snip.new: (condition,), values.iterator
}
my multi sub snip(@conditions, +values) {
Seq.new: Snip.new: @conditions, values.iterator
}
sub EXPORT() {
CORE::.EXISTS-KEY('&snip')
?? Map.new
!! Map.new: ('&snip' => &snip)
}
=begin pod
=head1 NAME
snip - Provide functionality similar to Haskell's span
=head1 SYNOPSIS
=begin code :lang<raku>
use snip;
.say for snip * < 10, 2, 2, 2, 5, 5, 7, 13, 9, 6, 2, 20, 4;
# (2 2 2 5 5 7)
# (13 9 6 2 20 4)
.say for snip (* < 10, * < 20), 2, 2, 2, 5, 5, 7, 13, 9, 6, 2, 20, 4;
# (2 2 2 5 5 7)
# (13 9 6 2)
# (20 4)
.say for snip Int, 2, 2, 2, 5, 5, "a", "b", "c";
# (2 2 2 5 5)
# (a b c)
=end code
=head1 DESCRIPTION
The C<snip> distribution exports a single subroutine C<snip> that mimics
the functionality provided by L<Haskell's span functionality|https://hackage.haskell.org/package/base-4.16.1.0/docs/Prelude.html#v:snip>.
But only if the core does not supply a C<snip> subroutine already (which
it may at some point in the future).
The C<snip> subroutine takes a matcher much like C<grep> does, which can
be a C<Callable> or any other object that can have the C<ACCEPTS> method
called on it. Different from the Haskell's C<span> implementation,
C<snip> can take multiple matchers to snip the origin list in more than
2 parts.
=head1 AUTHOR
Elizabeth Mattijsen <[email protected]>
Source can be located at: https://github.com/lizmat/snip .
Comments and Pull Requests are welcome.
If you like this module, or what I’m doing more generally, committing to a
L<small sponsorship|https://github.com/sponsors/lizmat/> would mean a great
deal to me!
=head1 COPYRIGHT AND LICENSE
Copyright 2022, 2024 Elizabeth Mattijsen
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
=end pod
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- sourcery
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: META6.json
### ----------------------------------------------------
{
"auth": "zef:lizmat",
"authors": [
"Elizabeth Mattijsen"
],
"build-depends": [
],
"depends": [
],
"description": "Turn a sub / method call into file(s) / linenumbers(s)",
"license": "Artistic-2.0",
"name": "sourcery",
"perl": "6.d",
"provides": {
"sourcery": "lib/sourcery.rakumod"
},
"resources": [
],
"source-url": "https://github.com/lizmat/sourcery.git",
"tags": [
"SOURCE",
"INTROSPECTION",
"TOOL"
],
"test-depends": [
],
"version": "0.0.6"
}
|
### ----------------------------------------------------
### -- sourcery
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: LICENSE
### ----------------------------------------------------
The Artistic License 2.0
Copyright (c) 2000-2006, The Perl Foundation.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
This license establishes the terms under which a given free software
Package may be copied, modified, distributed, and/or redistributed.
The intent is that the Copyright Holder maintains some artistic
control over the development of that Package while still keeping the
Package available as open source and free software.
You are always permitted to make arrangements wholly outside of this
license directly with the Copyright Holder of a given Package. If the
terms of this license do not permit the full use that you propose to
make of the Package, you should contact the Copyright Holder and seek
a different licensing arrangement.
Definitions
"Copyright Holder" means the individual(s) or organization(s)
named in the copyright notice for the entire Package.
"Contributor" means any party that has contributed code or other
material to the Package, in accordance with the Copyright Holder's
procedures.
"You" and "your" means any person who would like to copy,
distribute, or modify the Package.
"Package" means the collection of files distributed by the
Copyright Holder, and derivatives of that collection and/or of
those files. A given Package may consist of either the Standard
Version, or a Modified Version.
"Distribute" means providing a copy of the Package or making it
accessible to anyone else, or in the case of a company or
organization, to others outside of your company or organization.
"Distributor Fee" means any fee that you charge for Distributing
this Package or providing support for this Package to another
party. It does not mean licensing fees.
"Standard Version" refers to the Package if it has not been
modified, or has been modified only in ways explicitly requested
by the Copyright Holder.
"Modified Version" means the Package, if it has been changed, and
such changes were not explicitly requested by the Copyright
Holder.
"Original License" means this Artistic License as Distributed with
the Standard Version of the Package, in its current version or as
it may be modified by The Perl Foundation in the future.
"Source" form means the source code, documentation source, and
configuration files for the Package.
"Compiled" form means the compiled bytecode, object code, binary,
or any other form resulting from mechanical transformation or
translation of the Source form.
Permission for Use and Modification Without Distribution
(1) You are permitted to use the Standard Version and create and use
Modified Versions for any purpose without restriction, provided that
you do not Distribute the Modified Version.
Permissions for Redistribution of the Standard Version
(2) You may Distribute verbatim copies of the Source form of the
Standard Version of this Package in any medium without restriction,
either gratis or for a Distributor Fee, provided that you duplicate
all of the original copyright notices and associated disclaimers. At
your discretion, such verbatim copies may or may not include a
Compiled form of the Package.
(3) You may apply any bug fixes, portability changes, and other
modifications made available from the Copyright Holder. The resulting
Package will still be considered the Standard Version, and as such
will be subject to the Original License.
Distribution of Modified Versions of the Package as Source
(4) You may Distribute your Modified Version as Source (either gratis
or for a Distributor Fee, and with or without a Compiled form of the
Modified Version) provided that you clearly document how it differs
from the Standard Version, including, but not limited to, documenting
any non-standard features, executables, or modules, and provided that
you do at least ONE of the following:
(a) make the Modified Version available to the Copyright Holder
of the Standard Version, under the Original License, so that the
Copyright Holder may include your modifications in the Standard
Version.
(b) ensure that installation of your Modified Version does not
prevent the user installing or running the Standard Version. In
addition, the Modified Version must bear a name that is different
from the name of the Standard Version.
(c) allow anyone who receives a copy of the Modified Version to
make the Source form of the Modified Version available to others
under
(i) the Original License or
(ii) a license that permits the licensee to freely copy,
modify and redistribute the Modified Version using the same
licensing terms that apply to the copy that the licensee
received, and requires that the Source form of the Modified
Version, and of any works derived from it, be made freely
available in that license fees are prohibited but Distributor
Fees are allowed.
Distribution of Compiled Forms of the Standard Version
or Modified Versions without the Source
(5) You may Distribute Compiled forms of the Standard Version without
the Source, provided that you include complete instructions on how to
get the Source of the Standard Version. Such instructions must be
valid at the time of your distribution. If these instructions, at any
time while you are carrying out such distribution, become invalid, you
must provide new instructions on demand or cease further distribution.
If you provide valid instructions or cease distribution within thirty
days after you become aware that the instructions are invalid, then
you do not forfeit any of your rights under this license.
(6) You may Distribute a Modified Version in Compiled form without
the Source, provided that you comply with Section 4 with respect to
the Source of the Modified Version.
Aggregating or Linking the Package
(7) You may aggregate the Package (either the Standard Version or
Modified Version) with other packages and Distribute the resulting
aggregation provided that you do not charge a licensing fee for the
Package. Distributor Fees are permitted, and licensing fees for other
components in the aggregation are permitted. The terms of this license
apply to the use and Distribution of the Standard or Modified Versions
as included in the aggregation.
(8) You are permitted to link Modified and Standard Versions with
other works, to embed the Package in a larger work of your own, or to
build stand-alone binary or bytecode versions of applications that
include the Package, and Distribute the result without restriction,
provided the result does not expose a direct interface to the Package.
Items That are Not Considered Part of a Modified Version
(9) Works (including, but not limited to, modules and scripts) that
merely extend or make use of the Package, do not, by themselves, cause
the Package to be a Modified Version. In addition, such works are not
considered parts of the Package itself, and are not subject to the
terms of this license.
General Provisions
(10) Any use, modification, and distribution of the Standard or
Modified Versions is governed by this Artistic License. By using,
modifying or distributing the Package, you accept this license. Do not
use, modify, or distribute the Package, if you do not accept this
license.
(11) If your Modified Version has been derived from a Modified
Version made by someone other than you, you are nevertheless required
to ensure that your Modified Version complies with the requirements of
this license.
(12) This license does not grant you the right to use any trademark,
service mark, tradename, or logo of the Copyright Holder.
(13) This license includes the non-exclusive, worldwide,
free-of-charge patent license to make, have made, use, offer to sell,
sell, import and otherwise transfer the Package with respect to any
patent claims licensable by the Copyright Holder that are necessarily
infringed by the Package. If you institute patent litigation
(including a cross-claim or counterclaim) against any party alleging
that the Package constitutes direct or contributory patent
infringement, then this Artistic License to you shall terminate on the
date that such litigation is filed.
(14) Disclaimer of Warranty:
THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL
LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
### ----------------------------------------------------
### -- sourcery
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: README.md
### ----------------------------------------------------
[](https://github.com/lizmat/sourcery/actions) [](https://github.com/lizmat/sourcery/actions) [](https://github.com/lizmat/sourcery/actions)
NAME
====
sourcery - Turn a sub / method call into file(s) / linenumbers(s)
SYNOPSIS
========
```raku
use sourcery;
.say for sourcery '"42".Int'; # show where a Str gets converted to Int
.say for sourcery 'say "foo"'; # show where strings are being said
say needle 'say "foo"'; # 'sub say'
.say for sourcery 'Str.Int', :defined; # instantiate type object
say needle 'Str.Int'; # 'method Int'
use Edit::Files;
edit-files sourcery '42.base("beer")'; # go see where this easter egg lives
```
DESCRIPTION
===========
The sourcery module exports a two subroutines:
* sourcery
* needle
EXPORTED SUBROUTINES
====================
Both subroutines are exported by default.
sourcery
--------
The `sourcery` subroutine converts a string consisting of the code of a subroutine or method call, to zero or more file / line-number pairs. Which can then be displayed or used as input to go inspect / edit those files.
The `sourcery` subroutine also takes a single named argument: `:defined`. If specified, will instantiate any type object used as an invocant, so that it will match `class:D:` constraints in dispatching (see e.g. the difference between `"Str.Int"` and `"Str.Int", :defined`.
Inspired by Zoffix's [CoreHackers::Sourcery](https://raku.land/zef:raku-community-modules/CoreHackers::Sourcery) module, with the following differences:
* generates local file locations instead of URLs
* not limited to core code, could be used on any loaded codebase
needle
------
The `needle` subroutine takes the same string as with `sourcery` but instead returns a string that can serve as a pattern for highlighting the actual sub / method in the file / line that is being returned.
SELECTIVE IMPORTING
===================
```raku
use sourcery <sourcery>; # only export sub sourcery
```
By default all functions are exported. But you can limit this to the functions you actually need by specifying the names in the `use` statement.
To prevent name collisions and/or import any subroutine with a more memorable name, one can use the "original-name:known-as" syntax. A semi-colon in a specified string indicates the name by which the subroutine is known in this distribution, followed by the name with which it will be known in the lexical context in which the `use` command is executed.
CAVEATS
=======
Modules that have been loaded from an installation, will refer to the location inside the repository where the original source files are being kept. These files are considered immutable and should not be changed.
AUTHOR
======
Elizabeth Mattijsen <[email protected]>
Source can be located at: https://github.com/lizmat/sourcery . 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 2022, 2023, 2025 Elizabeth Mattijsen
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
|
### ----------------------------------------------------
### -- sourcery
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: dist.ini
### ----------------------------------------------------
name = sourcery
[ReadmeFromPod]
; enabled = false
filename = doc/sourcery.rakudoc
[UploadToZef]
[PruneFiles]
; match = ^ 'xt/'
[Badges]
provider = github-actions/linux.yml
provider = github-actions/macos.yml
provider = github-actions/windows.yml
|
### ----------------------------------------------------
### -- sourcery
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: t/01-basic.rakutest
### ----------------------------------------------------
use Test;
use sourcery;
plan 8;
is sourcery("Str.Numeric").elems, 1,
'does Str.Numeric give 1 location';
is needle("Str.Numeric"), 'method Numeric',
'does Str.Numeric give the right needle';
is sourcery("Str.Int", :defined).elems, 2,
'does Any:D.Str give 2 locations';
is needle("Str.Int"), 'method Int',
'does Any:D.Str give the right needle';
is sourcery('42.base("beer")').elems, 2,
'does 42.base("beer") give 2 locations';
is needle('42.base("beer")'), 'method base',
'does 42.base("beer") give the right needle';
is sourcery('say').elems, 2,
'does say give 2 locations';
is needle('say'), 'sub say',
'does say give the right needle';
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- sourcery
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: xt/coverage.rakutest
### ----------------------------------------------------
use Test::Coverage;
plan 2;
coverage-at-least 81;
uncovered-at-most 8;
source-with-coverage;
report;
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- sourcery
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: xt/02-sourcery.rakutest
### ----------------------------------------------------
use Test;
use sourcery;
plan 4;
for ('("foo")', ' "foo"').map({ "sourcery$_" }) {
is-deeply sourcery($_), (
$*PROGRAM.parent.sibling("lib").add("sourcery.rakumod").absolute => 1,
), "did it find itself with $_";
is needle($_), 'sub sourcery', "Did we get the right needle for $_";
}
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- sourcery
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: lib/sourcery.rakumod
### ----------------------------------------------------
my sub sourcery(Str:D $call, :$defined) {
my sub invocant-capture(Str:D $invocant, Str:D $args) {
($args
?? '\(' ~ $invocant ~ ', ' ~ $args ~ ')'
!! '\(' ~ $invocant ~ ')'
).EVAL
}
my sub do-sourcery(@blocks, $capture) {
my $path := $*EXECUTABLE.parent.parent.parent.absolute ~ $*SPEC.dir-sep;
@blocks.map(-> $block {
if $block.cando($capture) {
my $file := $block.file;
$file := $file.starts-with('SETTING::')
?? $path ~ $file.substr(9)
!! $file.subst(
/^ \w+ '#' /,
{
CompUnit::RepositoryRegistry.file-for-spec($/.Str)
~ $*SPEC.dir-sep
}
).subst(/ ' (' <-[)]>+ ')' $/);
$file => $block.line;
}
}).unique
}
(my $invocant, my $rest) = $call.split('.', 2);
if $rest.defined { # assume method call
my $self = $invocant.EVAL;
if $defined && !$self.DEFINITE {
$invocant ~= '.CREATE';
$self = $self.CREATE;
}
(my $method, my $args) = $rest.split('(', 2);
my $capture := do if $args.defined {
invocant-capture($invocant, $args.chop);
}
else {
($method, $args) = $rest.split(':', 2);
invocant-capture($invocant, $args // "");
}
do-sourcery $self.^can($method).map(*.candidates.Slip), $capture;
}
else { # assume sub call
(my $name, my $args) = $call.split('(', 2);
my $capture := do if $args.defined {
('\(' ~ $args).EVAL
}
else {
($name, $args) = $call.split(/ \s+ /, 2);
$capture := $args.defined
?? ('\(' ~ $args.trim ~ ')').EVAL
!! \()
}
do-sourcery ::("&$name").candidates, $capture;
}
}
my sub needle(Str:D $call) {
(my $, my $rest) = $call.split('.', 2);
if $rest.defined { # assume method call
(my $name, my $args) = $rest.split('(', 2);
($name, $args) = $rest.split(':', 2) unless $args.defined;
"method $name"
}
else { # assume sub call
(my $name, my $args) = $call.split('(', 2);
($name, $args) = $call.split(/ \s+ /, 2) unless $args.defined;
"sub $name"
}
}
my sub EXPORT(*@names) {
Map.new: @names
?? @names.map: {
if UNIT::{"&$_"}:exists {
UNIT::{"&$_"}:p
}
else {
my ($in,$out) = .split(':', 2);
if $out && UNIT::{"&$in"} -> &code {
Pair.new: "&$out", &code
}
}
}
!! UNIT::.grep: {
.key.starts-with('&') && .key ne '&EXPORT'
}
}
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- span
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: META6.json
### ----------------------------------------------------
{
"auth": "zef:lizmat",
"authors": [
"Elizabeth Mattijsen"
],
"build-depends": [
],
"depends": [
"snip:ver<0.0.2+>:auth<zef:lizmat>"
],
"description": "Provide Haskell's span functionality",
"license": "Artistic-2.0",
"name": "span",
"perl": "6.d",
"provides": {
"span": "lib/span.rakumod"
},
"resources": [
],
"source-url": "https://github.com/lizmat/span.git",
"tags": [
"SPAN"
],
"test-depends": [
],
"version": "0.0.2"
}
|
### ----------------------------------------------------
### -- span
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: LICENSE
### ----------------------------------------------------
The Artistic License 2.0
Copyright (c) 2000-2006, The Perl Foundation.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
This license establishes the terms under which a given free software
Package may be copied, modified, distributed, and/or redistributed.
The intent is that the Copyright Holder maintains some artistic
control over the development of that Package while still keeping the
Package available as open source and free software.
You are always permitted to make arrangements wholly outside of this
license directly with the Copyright Holder of a given Package. If the
terms of this license do not permit the full use that you propose to
make of the Package, you should contact the Copyright Holder and seek
a different licensing arrangement.
Definitions
"Copyright Holder" means the individual(s) or organization(s)
named in the copyright notice for the entire Package.
"Contributor" means any party that has contributed code or other
material to the Package, in accordance with the Copyright Holder's
procedures.
"You" and "your" means any person who would like to copy,
distribute, or modify the Package.
"Package" means the collection of files distributed by the
Copyright Holder, and derivatives of that collection and/or of
those files. A given Package may consist of either the Standard
Version, or a Modified Version.
"Distribute" means providing a copy of the Package or making it
accessible to anyone else, or in the case of a company or
organization, to others outside of your company or organization.
"Distributor Fee" means any fee that you charge for Distributing
this Package or providing support for this Package to another
party. It does not mean licensing fees.
"Standard Version" refers to the Package if it has not been
modified, or has been modified only in ways explicitly requested
by the Copyright Holder.
"Modified Version" means the Package, if it has been changed, and
such changes were not explicitly requested by the Copyright
Holder.
"Original License" means this Artistic License as Distributed with
the Standard Version of the Package, in its current version or as
it may be modified by The Perl Foundation in the future.
"Source" form means the source code, documentation source, and
configuration files for the Package.
"Compiled" form means the compiled bytecode, object code, binary,
or any other form resulting from mechanical transformation or
translation of the Source form.
Permission for Use and Modification Without Distribution
(1) You are permitted to use the Standard Version and create and use
Modified Versions for any purpose without restriction, provided that
you do not Distribute the Modified Version.
Permissions for Redistribution of the Standard Version
(2) You may Distribute verbatim copies of the Source form of the
Standard Version of this Package in any medium without restriction,
either gratis or for a Distributor Fee, provided that you duplicate
all of the original copyright notices and associated disclaimers. At
your discretion, such verbatim copies may or may not include a
Compiled form of the Package.
(3) You may apply any bug fixes, portability changes, and other
modifications made available from the Copyright Holder. The resulting
Package will still be considered the Standard Version, and as such
will be subject to the Original License.
Distribution of Modified Versions of the Package as Source
(4) You may Distribute your Modified Version as Source (either gratis
or for a Distributor Fee, and with or without a Compiled form of the
Modified Version) provided that you clearly document how it differs
from the Standard Version, including, but not limited to, documenting
any non-standard features, executables, or modules, and provided that
you do at least ONE of the following:
(a) make the Modified Version available to the Copyright Holder
of the Standard Version, under the Original License, so that the
Copyright Holder may include your modifications in the Standard
Version.
(b) ensure that installation of your Modified Version does not
prevent the user installing or running the Standard Version. In
addition, the Modified Version must bear a name that is different
from the name of the Standard Version.
(c) allow anyone who receives a copy of the Modified Version to
make the Source form of the Modified Version available to others
under
(i) the Original License or
(ii) a license that permits the licensee to freely copy,
modify and redistribute the Modified Version using the same
licensing terms that apply to the copy that the licensee
received, and requires that the Source form of the Modified
Version, and of any works derived from it, be made freely
available in that license fees are prohibited but Distributor
Fees are allowed.
Distribution of Compiled Forms of the Standard Version
or Modified Versions without the Source
(5) You may Distribute Compiled forms of the Standard Version without
the Source, provided that you include complete instructions on how to
get the Source of the Standard Version. Such instructions must be
valid at the time of your distribution. If these instructions, at any
time while you are carrying out such distribution, become invalid, you
must provide new instructions on demand or cease further distribution.
If you provide valid instructions or cease distribution within thirty
days after you become aware that the instructions are invalid, then
you do not forfeit any of your rights under this license.
(6) You may Distribute a Modified Version in Compiled form without
the Source, provided that you comply with Section 4 with respect to
the Source of the Modified Version.
Aggregating or Linking the Package
(7) You may aggregate the Package (either the Standard Version or
Modified Version) with other packages and Distribute the resulting
aggregation provided that you do not charge a licensing fee for the
Package. Distributor Fees are permitted, and licensing fees for other
components in the aggregation are permitted. The terms of this license
apply to the use and Distribution of the Standard or Modified Versions
as included in the aggregation.
(8) You are permitted to link Modified and Standard Versions with
other works, to embed the Package in a larger work of your own, or to
build stand-alone binary or bytecode versions of applications that
include the Package, and Distribute the result without restriction,
provided the result does not expose a direct interface to the Package.
Items That are Not Considered Part of a Modified Version
(9) Works (including, but not limited to, modules and scripts) that
merely extend or make use of the Package, do not, by themselves, cause
the Package to be a Modified Version. In addition, such works are not
considered parts of the Package itself, and are not subject to the
terms of this license.
General Provisions
(10) Any use, modification, and distribution of the Standard or
Modified Versions is governed by this Artistic License. By using,
modifying or distributing the Package, you accept this license. Do not
use, modify, or distribute the Package, if you do not accept this
license.
(11) If your Modified Version has been derived from a Modified
Version made by someone other than you, you are nevertheless required
to ensure that your Modified Version complies with the requirements of
this license.
(12) This license does not grant you the right to use any trademark,
service mark, tradename, or logo of the Copyright Holder.
(13) This license includes the non-exclusive, worldwide,
free-of-charge patent license to make, have made, use, offer to sell,
sell, import and otherwise transfer the Package with respect to any
patent claims licensable by the Copyright Holder that are necessarily
infringed by the Package. If you institute patent litigation
(including a cross-claim or counterclaim) against any party alleging
that the Package constitutes direct or contributory patent
infringement, then this Artistic License to you shall terminate on the
date that such litigation is filed.
(14) Disclaimer of Warranty:
THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL
LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
### ----------------------------------------------------
### -- span
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: README.md
### ----------------------------------------------------
[](https://github.com/lizmat/span/actions) [](https://github.com/lizmat/span/actions) [](https://github.com/lizmat/span/actions)
NAME
====
span - Provide Haskell's span functionality
SYNOPSIS
========
```raku
use span;
.say for span * < 10, 2, 2, 2, 5, 5, 7, 13, 9, 6, 2, 20, 4;
# (2 2 2 5 5 7)
# (13 9 6 2 20 4)
.say for span (* < 10, * < 20), 2, 2, 2, 5, 5, 7, 13, 9, 6, 2, 20, 4;
# (2 2 2 5 5 7)
# (13 9 6 2)
# (20 4)
.say for span Int, 2, 2, 2, 5, 5, "a", "b", "c";
# (2 2 2 5 5)
# (a b c)
```
DESCRIPTION
===========
NOTE: this distribution has been deprecated in favour of the [snip](https://raku.land/zef:lizmat/snip) distribution.
The `span` distribution exports a single subroutine `span` that mimics the functionality provided by [Haskell's span functionality](https://hackage.haskell.org/package/base-4.16.1.0/docs/Prelude.html#v:span).
The `span` subroutine takes a matcher much like `grep` does, which can be a `Callable` or any other object that can have the `ACCEPTS` method called on it.
AUTHOR
======
Elizabeth Mattijsen <[email protected]>
Source can be located at: https://github.com/lizmat/span . 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 2022, 2025 Elizabeth Mattijsen
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
|
### ----------------------------------------------------
### -- span
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: dist.ini
### ----------------------------------------------------
name = span
[ReadmeFromPod]
; enabled = false
filename = lib/span.rakumod
[UploadToZef]
[PruneFiles]
; match = ^ 'xt/'
[Badges]
provider = github-actions/linux.yml
provider = github-actions/macos.yml
provider = github-actions/windows.yml
|
### ----------------------------------------------------
### -- span
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: t/01-basic.rakutest
### ----------------------------------------------------
use Test;
use span;
plan 3;
is-deeply span(* < 10, 2, 2, 2, 5, 5, 7, 13, 9, 6, 2, 20, 4),
((2,2,2,5,5,7), (13,9,6,2,20,4)),
'span with a single Callable';
is-deeply span( (* < 10, * < 20), 2, 2, 2, 5, 5, 7, 13, 9, 6, 2, 20, 4),
((2,2,2,5,5,7),(13,9,6,2),(20,4)),
'span with two Callables';
is-deeply span( Int, 2, 2, 2, 5, 5, "a", "b", "c"),
((2,2,2,5,5),<a b c>),
'span with a type object';
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- span
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: lib/span.rakumod
### ----------------------------------------------------
use snip:ver<0.0.2+>:auth<zef:lizmat>;
sub EXPORT() { Map.new: ('&span' => &snip) }
=begin pod
=head1 NAME
span - Provide Haskell's span functionality
=head1 SYNOPSIS
=begin code :lang<raku>
use span;
.say for span * < 10, 2, 2, 2, 5, 5, 7, 13, 9, 6, 2, 20, 4;
# (2 2 2 5 5 7)
# (13 9 6 2 20 4)
.say for span (* < 10, * < 20), 2, 2, 2, 5, 5, 7, 13, 9, 6, 2, 20, 4;
# (2 2 2 5 5 7)
# (13 9 6 2)
# (20 4)
.say for span Int, 2, 2, 2, 5, 5, "a", "b", "c";
# (2 2 2 5 5)
# (a b c)
=end code
=head1 DESCRIPTION
NOTE: this distribution has been deprecated in favour of the
L<snip|https://raku.land/zef:lizmat/snip> distribution.
The C<span> distribution exports a single subroutine C<span> that mimics
the functionality provided by L<Haskell's span functionality|https://hackage.haskell.org/package/base-4.16.1.0/docs/Prelude.html#v:span>.
The C<span> subroutine takes a matcher much like C<grep> does, which can
be a C<Callable> or any other object that can have the C<ACCEPTS> method
called on it.
=head1 AUTHOR
Elizabeth Mattijsen <[email protected]>
Source can be located at: https://github.com/lizmat/span .
Comments and Pull Requests are welcome.
If you like this module, or what I’m doing more generally, committing to a
L<small sponsorship|https://github.com/sponsors/lizmat/> would mean a great
deal to me!
=head1 COPYRIGHT AND LICENSE
Copyright 2022, 2025 Elizabeth Mattijsen
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
=end pod
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- subs
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: META6.json
### ----------------------------------------------------
{
"auth": "zef:lizmat",
"authors": [
"Elizabeth Mattijsen"
],
"build-depends": [
],
"depends": [
],
"description": "Raku port of Perl's 'subs' pragma",
"license": "Artistic-2.0",
"name": "subs",
"perl": "6.c",
"provides": {
"subs": "lib/subs.rakumod"
},
"resources": [
],
"source-url": "https://github.com/lizmat/subs.git",
"tags": [
"UTILS",
"CPAN5"
],
"test-depends": [
],
"version": "0.0.4"
}
|
### ----------------------------------------------------
### -- subs
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: LICENSE
### ----------------------------------------------------
The Artistic License 2.0
Copyright (c) 2000-2006, The Perl Foundation.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
This license establishes the terms under which a given free software
Package may be copied, modified, distributed, and/or redistributed.
The intent is that the Copyright Holder maintains some artistic
control over the development of that Package while still keeping the
Package available as open source and free software.
You are always permitted to make arrangements wholly outside of this
license directly with the Copyright Holder of a given Package. If the
terms of this license do not permit the full use that you propose to
make of the Package, you should contact the Copyright Holder and seek
a different licensing arrangement.
Definitions
"Copyright Holder" means the individual(s) or organization(s)
named in the copyright notice for the entire Package.
"Contributor" means any party that has contributed code or other
material to the Package, in accordance with the Copyright Holder's
procedures.
"You" and "your" means any person who would like to copy,
distribute, or modify the Package.
"Package" means the collection of files distributed by the
Copyright Holder, and derivatives of that collection and/or of
those files. A given Package may consist of either the Standard
Version, or a Modified Version.
"Distribute" means providing a copy of the Package or making it
accessible to anyone else, or in the case of a company or
organization, to others outside of your company or organization.
"Distributor Fee" means any fee that you charge for Distributing
this Package or providing support for this Package to another
party. It does not mean licensing fees.
"Standard Version" refers to the Package if it has not been
modified, or has been modified only in ways explicitly requested
by the Copyright Holder.
"Modified Version" means the Package, if it has been changed, and
such changes were not explicitly requested by the Copyright
Holder.
"Original License" means this Artistic License as Distributed with
the Standard Version of the Package, in its current version or as
it may be modified by The Perl Foundation in the future.
"Source" form means the source code, documentation source, and
configuration files for the Package.
"Compiled" form means the compiled bytecode, object code, binary,
or any other form resulting from mechanical transformation or
translation of the Source form.
Permission for Use and Modification Without Distribution
(1) You are permitted to use the Standard Version and create and use
Modified Versions for any purpose without restriction, provided that
you do not Distribute the Modified Version.
Permissions for Redistribution of the Standard Version
(2) You may Distribute verbatim copies of the Source form of the
Standard Version of this Package in any medium without restriction,
either gratis or for a Distributor Fee, provided that you duplicate
all of the original copyright notices and associated disclaimers. At
your discretion, such verbatim copies may or may not include a
Compiled form of the Package.
(3) You may apply any bug fixes, portability changes, and other
modifications made available from the Copyright Holder. The resulting
Package will still be considered the Standard Version, and as such
will be subject to the Original License.
Distribution of Modified Versions of the Package as Source
(4) You may Distribute your Modified Version as Source (either gratis
or for a Distributor Fee, and with or without a Compiled form of the
Modified Version) provided that you clearly document how it differs
from the Standard Version, including, but not limited to, documenting
any non-standard features, executables, or modules, and provided that
you do at least ONE of the following:
(a) make the Modified Version available to the Copyright Holder
of the Standard Version, under the Original License, so that the
Copyright Holder may include your modifications in the Standard
Version.
(b) ensure that installation of your Modified Version does not
prevent the user installing or running the Standard Version. In
addition, the Modified Version must bear a name that is different
from the name of the Standard Version.
(c) allow anyone who receives a copy of the Modified Version to
make the Source form of the Modified Version available to others
under
(i) the Original License or
(ii) a license that permits the licensee to freely copy,
modify and redistribute the Modified Version using the same
licensing terms that apply to the copy that the licensee
received, and requires that the Source form of the Modified
Version, and of any works derived from it, be made freely
available in that license fees are prohibited but Distributor
Fees are allowed.
Distribution of Compiled Forms of the Standard Version
or Modified Versions without the Source
(5) You may Distribute Compiled forms of the Standard Version without
the Source, provided that you include complete instructions on how to
get the Source of the Standard Version. Such instructions must be
valid at the time of your distribution. If these instructions, at any
time while you are carrying out such distribution, become invalid, you
must provide new instructions on demand or cease further distribution.
If you provide valid instructions or cease distribution within thirty
days after you become aware that the instructions are invalid, then
you do not forfeit any of your rights under this license.
(6) You may Distribute a Modified Version in Compiled form without
the Source, provided that you comply with Section 4 with respect to
the Source of the Modified Version.
Aggregating or Linking the Package
(7) You may aggregate the Package (either the Standard Version or
Modified Version) with other packages and Distribute the resulting
aggregation provided that you do not charge a licensing fee for the
Package. Distributor Fees are permitted, and licensing fees for other
components in the aggregation are permitted. The terms of this license
apply to the use and Distribution of the Standard or Modified Versions
as included in the aggregation.
(8) You are permitted to link Modified and Standard Versions with
other works, to embed the Package in a larger work of your own, or to
build stand-alone binary or bytecode versions of applications that
include the Package, and Distribute the result without restriction,
provided the result does not expose a direct interface to the Package.
Items That are Not Considered Part of a Modified Version
(9) Works (including, but not limited to, modules and scripts) that
merely extend or make use of the Package, do not, by themselves, cause
the Package to be a Modified Version. In addition, such works are not
considered parts of the Package itself, and are not subject to the
terms of this license.
General Provisions
(10) Any use, modification, and distribution of the Standard or
Modified Versions is governed by this Artistic License. By using,
modifying or distributing the Package, you accept this license. Do not
use, modify, or distribute the Package, if you do not accept this
license.
(11) If your Modified Version has been derived from a Modified
Version made by someone other than you, you are nevertheless required
to ensure that your Modified Version complies with the requirements of
this license.
(12) This license does not grant you the right to use any trademark,
service mark, tradename, or logo of the Copyright Holder.
(13) This license includes the non-exclusive, worldwide,
free-of-charge patent license to make, have made, use, offer to sell,
sell, import and otherwise transfer the Package with respect to any
patent claims licensable by the Copyright Holder that are necessarily
infringed by the Package. If you institute patent litigation
(including a cross-claim or counterclaim) against any party alleging
that the Package constitutes direct or contributory patent
infringement, then this Artistic License to you shall terminate on the
date that such litigation is filed.
(14) Disclaimer of Warranty:
THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL
LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
### ----------------------------------------------------
### -- subs
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: README.md
### ----------------------------------------------------
[](https://github.com/lizmat/subs/actions)
NAME
====
Raku port of Perl's "subs" pragma
SYNOPSIS
========
use subs <frob>;
frob 3..10;
DESCRIPTION
===========
This module tries to mimic the behaviour of Perl's `subs` pragma as closely as possible in the Raku Programming Language.
This will predeclare all the subroutine whose names are in the list, allowing you to use them without parentheses even before they're declared.
Unlike pragmas that affect the $^H hints variable, the "use vars" and "use subs" declarations are not BLOCK-scoped. They are thus effective for the entire package in which they appear. You may not rescind such declarations with "no vars" or "no subs".
See "Pragmatic Modules" in perlmodlib and "strict subs" in strict.
PORTING CAVEATS
===============
Due to the nature of the export mechanism in Raku, it is impossible (at the moment of this writing: 2019.11) to export to the OUR:: stash from a module. Therefore the Raku version of this module exports to the **lexical** scope in which the `use` command occurs. For most standars uses, this is equivalent to the Perl behaviour.
If you really want to create stubs in the `OUR::` stash, you can run the following code in your program:
BEGIN OUR::{$_} := sub { ... } for <&foo &bar &baz>;
AUTHOR
======
Elizabeth Mattijsen <[email protected]>
Source can be located at: https://github.com/lizmat/subs . 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.
|
### ----------------------------------------------------
### -- subs
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: dist.ini
### ----------------------------------------------------
name = subs
[ReadmeFromPod]
; enable = false
filename = lib/subs.rakumod
[PruneFiles]
; match = ^ 'xt/'
[Badges]
provider = github-actions/test
[UploadToZef]
|
### ----------------------------------------------------
### -- subs
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: t/01-basic.t
### ----------------------------------------------------
use v6.*;
use Test;
BEGIN my @subs = <foo bar baz>;
BEGIN plan 3 * @subs;;
use subs @subs;
BEGIN ok ::{ '&' ~ $_ }:exists, "did we get an export for $_ at BEGIN" for @subs;
BEGIN dies-ok { foo }, 'did the executing stub foo die';
BEGIN dies-ok { bar }, 'did the executing stub bar die';
BEGIN dies-ok { baz }, 'did the executing stub baz die';
sub foo() { "foo" }
sub bar() { "bar" }
sub baz() { "baz" }
is foo, "foo", 'did we get the right foo';
is bar, "bar", 'did we get the right bar';
is baz, "baz", 'did we get the right baz';
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- subs
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: lib/subs.rakumod
### ----------------------------------------------------
use v6.*;
module subs:ver<0.0.4>:auth<zef:lizmat> { }
sub EXPORT(*@subs) {
my %export;
%export{ '&' ~ $_ } := sub { ... } for @subs;
%export
}
=begin pod
=head1 NAME
Raku port of Perl's "subs" pragma
=head1 SYNOPSIS
use subs <frob>;
frob 3..10;
=head1 DESCRIPTION
This module tries to mimic the behaviour of Perl's C<subs> pragma
as closely as possible in the Raku Programming Language.
This will predeclare all the subroutine whose names are in the list,
allowing you to use them without parentheses even before they're declared.
Unlike pragmas that affect the $^H hints variable, the "use vars" and "use
subs" declarations are not BLOCK-scoped. They are thus effective for the
entire package in which they appear. You may not rescind such declarations
with "no vars" or "no subs".
See "Pragmatic Modules" in perlmodlib and "strict subs" in strict.
=head1 PORTING CAVEATS
Due to the nature of the export mechanism in Raku, it is impossible (at the
moment of this writing: 2019.11) to export to the OUR:: stash from a module.
Therefore the Raku version of this module exports to the B<lexical> scope in
which the C<use> command occurs. For most standars uses, this is equivalent
to the Perl behaviour.
If you really want to create stubs in the C<OUR::> stash, you can run the
following code in your program:
BEGIN OUR::{$_} := sub { ... } for <&foo &bar &baz>;
=head1 AUTHOR
Elizabeth Mattijsen <[email protected]>
Source can be located at: https://github.com/lizmat/subs . Comments and
Pull Requests are welcome.
=head1 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.
=end pod
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- under-version-control
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: META6.json
### ----------------------------------------------------
{
"auth": "zef:lizmat",
"authors": [
"Elizabeth Mattijsen"
],
"build-depends": [
],
"depends": [
],
"description": "is an IO::Path under version control?",
"license": "Artistic-2.0",
"name": "under-version-control",
"perl": "6.d",
"provides": {
"under-version-control": "lib/under-version-control.rakumod"
},
"resources": [
],
"source-url": "https://github.com/lizmat/under-version-control.git",
"tags": [
"IO",
"VCS",
"VERSION",
"CONTROL"
],
"test-depends": [
],
"version": "0.0.3"
}
|
### ----------------------------------------------------
### -- under-version-control
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: LICENSE
### ----------------------------------------------------
The Artistic License 2.0
Copyright (c) 2000-2006, The Perl Foundation.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
This license establishes the terms under which a given free software
Package may be copied, modified, distributed, and/or redistributed.
The intent is that the Copyright Holder maintains some artistic
control over the development of that Package while still keeping the
Package available as open source and free software.
You are always permitted to make arrangements wholly outside of this
license directly with the Copyright Holder of a given Package. If the
terms of this license do not permit the full use that you propose to
make of the Package, you should contact the Copyright Holder and seek
a different licensing arrangement.
Definitions
"Copyright Holder" means the individual(s) or organization(s)
named in the copyright notice for the entire Package.
"Contributor" means any party that has contributed code or other
material to the Package, in accordance with the Copyright Holder's
procedures.
"You" and "your" means any person who would like to copy,
distribute, or modify the Package.
"Package" means the collection of files distributed by the
Copyright Holder, and derivatives of that collection and/or of
those files. A given Package may consist of either the Standard
Version, or a Modified Version.
"Distribute" means providing a copy of the Package or making it
accessible to anyone else, or in the case of a company or
organization, to others outside of your company or organization.
"Distributor Fee" means any fee that you charge for Distributing
this Package or providing support for this Package to another
party. It does not mean licensing fees.
"Standard Version" refers to the Package if it has not been
modified, or has been modified only in ways explicitly requested
by the Copyright Holder.
"Modified Version" means the Package, if it has been changed, and
such changes were not explicitly requested by the Copyright
Holder.
"Original License" means this Artistic License as Distributed with
the Standard Version of the Package, in its current version or as
it may be modified by The Perl Foundation in the future.
"Source" form means the source code, documentation source, and
configuration files for the Package.
"Compiled" form means the compiled bytecode, object code, binary,
or any other form resulting from mechanical transformation or
translation of the Source form.
Permission for Use and Modification Without Distribution
(1) You are permitted to use the Standard Version and create and use
Modified Versions for any purpose without restriction, provided that
you do not Distribute the Modified Version.
Permissions for Redistribution of the Standard Version
(2) You may Distribute verbatim copies of the Source form of the
Standard Version of this Package in any medium without restriction,
either gratis or for a Distributor Fee, provided that you duplicate
all of the original copyright notices and associated disclaimers. At
your discretion, such verbatim copies may or may not include a
Compiled form of the Package.
(3) You may apply any bug fixes, portability changes, and other
modifications made available from the Copyright Holder. The resulting
Package will still be considered the Standard Version, and as such
will be subject to the Original License.
Distribution of Modified Versions of the Package as Source
(4) You may Distribute your Modified Version as Source (either gratis
or for a Distributor Fee, and with or without a Compiled form of the
Modified Version) provided that you clearly document how it differs
from the Standard Version, including, but not limited to, documenting
any non-standard features, executables, or modules, and provided that
you do at least ONE of the following:
(a) make the Modified Version available to the Copyright Holder
of the Standard Version, under the Original License, so that the
Copyright Holder may include your modifications in the Standard
Version.
(b) ensure that installation of your Modified Version does not
prevent the user installing or running the Standard Version. In
addition, the Modified Version must bear a name that is different
from the name of the Standard Version.
(c) allow anyone who receives a copy of the Modified Version to
make the Source form of the Modified Version available to others
under
(i) the Original License or
(ii) a license that permits the licensee to freely copy,
modify and redistribute the Modified Version using the same
licensing terms that apply to the copy that the licensee
received, and requires that the Source form of the Modified
Version, and of any works derived from it, be made freely
available in that license fees are prohibited but Distributor
Fees are allowed.
Distribution of Compiled Forms of the Standard Version
or Modified Versions without the Source
(5) You may Distribute Compiled forms of the Standard Version without
the Source, provided that you include complete instructions on how to
get the Source of the Standard Version. Such instructions must be
valid at the time of your distribution. If these instructions, at any
time while you are carrying out such distribution, become invalid, you
must provide new instructions on demand or cease further distribution.
If you provide valid instructions or cease distribution within thirty
days after you become aware that the instructions are invalid, then
you do not forfeit any of your rights under this license.
(6) You may Distribute a Modified Version in Compiled form without
the Source, provided that you comply with Section 4 with respect to
the Source of the Modified Version.
Aggregating or Linking the Package
(7) You may aggregate the Package (either the Standard Version or
Modified Version) with other packages and Distribute the resulting
aggregation provided that you do not charge a licensing fee for the
Package. Distributor Fees are permitted, and licensing fees for other
components in the aggregation are permitted. The terms of this license
apply to the use and Distribution of the Standard or Modified Versions
as included in the aggregation.
(8) You are permitted to link Modified and Standard Versions with
other works, to embed the Package in a larger work of your own, or to
build stand-alone binary or bytecode versions of applications that
include the Package, and Distribute the result without restriction,
provided the result does not expose a direct interface to the Package.
Items That are Not Considered Part of a Modified Version
(9) Works (including, but not limited to, modules and scripts) that
merely extend or make use of the Package, do not, by themselves, cause
the Package to be a Modified Version. In addition, such works are not
considered parts of the Package itself, and are not subject to the
terms of this license.
General Provisions
(10) Any use, modification, and distribution of the Standard or
Modified Versions is governed by this Artistic License. By using,
modifying or distributing the Package, you accept this license. Do not
use, modify, or distribute the Package, if you do not accept this
license.
(11) If your Modified Version has been derived from a Modified
Version made by someone other than you, you are nevertheless required
to ensure that your Modified Version complies with the requirements of
this license.
(12) This license does not grant you the right to use any trademark,
service mark, tradename, or logo of the Copyright Holder.
(13) This license includes the non-exclusive, worldwide,
free-of-charge patent license to make, have made, use, offer to sell,
sell, import and otherwise transfer the Package with respect to any
patent claims licensable by the Copyright Holder that are necessarily
infringed by the Package. If you institute patent litigation
(including a cross-claim or counterclaim) against any party alleging
that the Package constitutes direct or contributory patent
infringement, then this Artistic License to you shall terminate on the
date that such litigation is filed.
(14) Disclaimer of Warranty:
THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL
LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
### ----------------------------------------------------
### -- under-version-control
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: README.md
### ----------------------------------------------------
[](https://github.com/lizmat/under-version-control/actions) [](https://github.com/lizmat/under-version-control/actions) [](https://github.com/lizmat/under-version-control/actions)
NAME
====
under-version-control - is an IO::Path under version control?
SYNOPSIS
========
```raku
use under-version-control;
say "current directory is under version control"
if ".".IO.&under-version-control;
say "file 'foo.bar' is under version control"
if under-version-control "foo.bar".IO;
```
DESCRIPTION
===========
under::version::control provides a subroutine that returns True if the argument appears to be under version control.
This is currently defined as it having a sibling ".git" directory, or any of its parents having a ".git" directory.
Intended to be used by CLI scripts before they do massive changes on a file system: being under version control provides a bigger chance of reversibility if something went wrong.
SEE ALSO
========
For more fine-grained control on whether a path is under version control, you can also use the [`Git::Files`](https://raku.land/zef:lizmat/Git::Files) distribution for that, or the git related functions in [`path-utils`](https://raku.land/zef:lizmat/path-utils).
AUTHOR
======
Elizabeth Mattijsen <[email protected]>
Source can be located at: https://github.com/lizmat/under-version-control . 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 2022, 2025 Elizabeth Mattijsen
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
|
### ----------------------------------------------------
### -- under-version-control
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: dist.ini
### ----------------------------------------------------
name = under-version-control
[ReadmeFromPod]
; enabled = false
filename = doc/under-version-control.rakudoc
[UploadToZef]
[PruneFiles]
; match = ^ 'xt/'
[Badges]
provider = github-actions/linux.yml
provider = github-actions/macos.yml
provider = github-actions/windows.yml
|
### ----------------------------------------------------
### -- under-version-control
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: t/01-basic.rakutest
### ----------------------------------------------------
use Test;
use under-version-control;
plan 2;
my $tmpdir := $*TMPDIR;
my $git := $tmpdir.add(".git");
LEAVE $git.rmdir if $git.d;
is-deeply $tmpdir.&under-version-control, False, 'before';
$git.mkdir;
is-deeply $tmpdir.&under-version-control, True, 'after';
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- under-version-control
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: xt/coverage.rakutest
### ----------------------------------------------------
use Test::Coverage;
must-be-complete;
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- under-version-control
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: lib/under-version-control.rakumod
### ----------------------------------------------------
my sub under-version-control(IO::Path:D $io is copy --> Bool:D) is export {
$io .= resolve;
(my $parent := $io.parent.resolve) eqv $io
?? (return False)
!! ($io = $parent)
until $io.add(".git").d;
True
}
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- uniname-words
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: META6.json
### ----------------------------------------------------
{
"auth": "zef:lizmat",
"authors": [
"Elizabeth Mattijsen"
],
"build-depends": [
],
"depends": [
"Map::Match:ver<0.0.8+>:auth<zef:lizmat>"
],
"description": "look for words in unicode character names",
"license": "Artistic-2.0",
"name": "uniname-words",
"perl": "6.d",
"provides": {
"uniname-words": "lib/uniname-words.rakumod"
},
"resources": [
],
"source-url": "https://github.com/lizmat/uniname-words.git",
"tags": [
"UNICODE"
],
"test-depends": [
],
"version": "10.0.15"
}
|
### ----------------------------------------------------
### -- uniname-words
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: LICENSE
### ----------------------------------------------------
The Artistic License 2.0
Copyright (c) 2000-2006, The Perl Foundation.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
This license establishes the terms under which a given free software
Package may be copied, modified, distributed, and/or redistributed.
The intent is that the Copyright Holder maintains some artistic
control over the development of that Package while still keeping the
Package available as open source and free software.
You are always permitted to make arrangements wholly outside of this
license directly with the Copyright Holder of a given Package. If the
terms of this license do not permit the full use that you propose to
make of the Package, you should contact the Copyright Holder and seek
a different licensing arrangement.
Definitions
"Copyright Holder" means the individual(s) or organization(s)
named in the copyright notice for the entire Package.
"Contributor" means any party that has contributed code or other
material to the Package, in accordance with the Copyright Holder's
procedures.
"You" and "your" means any person who would like to copy,
distribute, or modify the Package.
"Package" means the collection of files distributed by the
Copyright Holder, and derivatives of that collection and/or of
those files. A given Package may consist of either the Standard
Version, or a Modified Version.
"Distribute" means providing a copy of the Package or making it
accessible to anyone else, or in the case of a company or
organization, to others outside of your company or organization.
"Distributor Fee" means any fee that you charge for Distributing
this Package or providing support for this Package to another
party. It does not mean licensing fees.
"Standard Version" refers to the Package if it has not been
modified, or has been modified only in ways explicitly requested
by the Copyright Holder.
"Modified Version" means the Package, if it has been changed, and
such changes were not explicitly requested by the Copyright
Holder.
"Original License" means this Artistic License as Distributed with
the Standard Version of the Package, in its current version or as
it may be modified by The Perl Foundation in the future.
"Source" form means the source code, documentation source, and
configuration files for the Package.
"Compiled" form means the compiled bytecode, object code, binary,
or any other form resulting from mechanical transformation or
translation of the Source form.
Permission for Use and Modification Without Distribution
(1) You are permitted to use the Standard Version and create and use
Modified Versions for any purpose without restriction, provided that
you do not Distribute the Modified Version.
Permissions for Redistribution of the Standard Version
(2) You may Distribute verbatim copies of the Source form of the
Standard Version of this Package in any medium without restriction,
either gratis or for a Distributor Fee, provided that you duplicate
all of the original copyright notices and associated disclaimers. At
your discretion, such verbatim copies may or may not include a
Compiled form of the Package.
(3) You may apply any bug fixes, portability changes, and other
modifications made available from the Copyright Holder. The resulting
Package will still be considered the Standard Version, and as such
will be subject to the Original License.
Distribution of Modified Versions of the Package as Source
(4) You may Distribute your Modified Version as Source (either gratis
or for a Distributor Fee, and with or without a Compiled form of the
Modified Version) provided that you clearly document how it differs
from the Standard Version, including, but not limited to, documenting
any non-standard features, executables, or modules, and provided that
you do at least ONE of the following:
(a) make the Modified Version available to the Copyright Holder
of the Standard Version, under the Original License, so that the
Copyright Holder may include your modifications in the Standard
Version.
(b) ensure that installation of your Modified Version does not
prevent the user installing or running the Standard Version. In
addition, the Modified Version must bear a name that is different
from the name of the Standard Version.
(c) allow anyone who receives a copy of the Modified Version to
make the Source form of the Modified Version available to others
under
(i) the Original License or
(ii) a license that permits the licensee to freely copy,
modify and redistribute the Modified Version using the same
licensing terms that apply to the copy that the licensee
received, and requires that the Source form of the Modified
Version, and of any works derived from it, be made freely
available in that license fees are prohibited but Distributor
Fees are allowed.
Distribution of Compiled Forms of the Standard Version
or Modified Versions without the Source
(5) You may Distribute Compiled forms of the Standard Version without
the Source, provided that you include complete instructions on how to
get the Source of the Standard Version. Such instructions must be
valid at the time of your distribution. If these instructions, at any
time while you are carrying out such distribution, become invalid, you
must provide new instructions on demand or cease further distribution.
If you provide valid instructions or cease distribution within thirty
days after you become aware that the instructions are invalid, then
you do not forfeit any of your rights under this license.
(6) You may Distribute a Modified Version in Compiled form without
the Source, provided that you comply with Section 4 with respect to
the Source of the Modified Version.
Aggregating or Linking the Package
(7) You may aggregate the Package (either the Standard Version or
Modified Version) with other packages and Distribute the resulting
aggregation provided that you do not charge a licensing fee for the
Package. Distributor Fees are permitted, and licensing fees for other
components in the aggregation are permitted. The terms of this license
apply to the use and Distribution of the Standard or Modified Versions
as included in the aggregation.
(8) You are permitted to link Modified and Standard Versions with
other works, to embed the Package in a larger work of your own, or to
build stand-alone binary or bytecode versions of applications that
include the Package, and Distribute the result without restriction,
provided the result does not expose a direct interface to the Package.
Items That are Not Considered Part of a Modified Version
(9) Works (including, but not limited to, modules and scripts) that
merely extend or make use of the Package, do not, by themselves, cause
the Package to be a Modified Version. In addition, such works are not
considered parts of the Package itself, and are not subject to the
terms of this license.
General Provisions
(10) Any use, modification, and distribution of the Standard or
Modified Versions is governed by this Artistic License. By using,
modifying or distributing the Package, you accept this license. Do not
use, modify, or distribute the Package, if you do not accept this
license.
(11) If your Modified Version has been derived from a Modified
Version made by someone other than you, you are nevertheless required
to ensure that your Modified Version complies with the requirements of
this license.
(12) This license does not grant you the right to use any trademark,
service mark, tradename, or logo of the Copyright Holder.
(13) This license includes the non-exclusive, worldwide,
free-of-charge patent license to make, have made, use, offer to sell,
sell, import and otherwise transfer the Package with respect to any
patent claims licensable by the Copyright Holder that are necessarily
infringed by the Package. If you institute patent litigation
(including a cross-claim or counterclaim) against any party alleging
that the Package constitutes direct or contributory patent
infringement, then this Artistic License to you shall terminate on the
date that such litigation is filed.
(14) Disclaimer of Warranty:
THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL
LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
### ----------------------------------------------------
### -- uniname-words
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: README.md
### ----------------------------------------------------
[](https://github.com/lizmat/uniname-words/actions) [](https://github.com/lizmat/uniname-words/actions) [](https://github.com/lizmat/uniname-words/actions)
NAME
====
uniname-words - look for words in unicode character names
SYNOPSIS
========
```raku
use uniname-words;
say uniname-words.elems; # 262166
say .uniname for uniname-words<love>;
# LOVE HOTEL
# LOVE LETTER
# I LOVE YOU HAND SIGN
say .uniname for uniname-words(<left bracket>);
```
DESCRIPTION
===========
The `uniname-words` distribution exports a single subroutine: `uniname-words`. When called without a parameter, it returns a `Map` with each word (/w+) from the unicode database (active at installation of the module) as a key (in lowercase), and an `int32` array of the codepoints that have that word in their name, as the value.
All Unicode reserved codepoints are available under the `reserved` key: the rest of the name can be deduced from the codepoint value.
When the `uniname-words` sub is called with one or more arguments, they are considered to be words to return the codepoints of: these can be specified as a `Str` or as a `Regex`. Given words will be automatically lowercased to be checked. An optional `:partial` named argument can be specified to return the codepoints of words that partially match.
By default, if more than one word has been specified, **all** words must occur in the unicode name to be included. An optional `:any` named argument can be specified that **any** of the specified words should occur.
uw
==
This module also install a command-line utility `uw`, that takes one or more words, and the `--partial` and `--any` parameters, just like the `uniname-words` sub does, and lists the names of the selected code points on STDOUT. It also additionally takes a `--hex` parameter (to just see the hexadecimal values), a `--name` parameter (to just see the names) and/or a `--char` (to just see a rendition). These 3 parameters can also be mixed in any combination.
un
==
This module also install a command-line utility `un`, that takes one or more strings, and lists the names of the code points of these strings on STDOUT. It also additionally takes a `--hex` parameter (to just see the hexadecimal values), a `--name` parameter (to just see the names) and/or a `--char` (to just see a rendition). These 3 parameters can also be mixed in any combination.
INSTALLATION NOTE
=================
Installing (or running this module for the first time after a runtime update) may take up to a minute (or possibly more on slower machines) because the entire unicode database is *then* checked, allowing it to remain up-to-date across versions of the run-time.
AUTHOR
======
Elizabeth Mattijsen <[email protected]>
Source can be located at: https://github.com/lizmat/uniname-words . Comments and Pull Requests are welcome.
If you like this module, or what I’m doing more generally, committing to a [small sponsorship](https://github.com/sponsors/lizmat/) would mean a great deal to me!
COPYRIGHT AND LICENSE
=====================
Copyright 2021, 2022, 2023, 2024, 2025 Elizabeth Mattijsen
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
|
### ----------------------------------------------------
### -- uniname-words
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: dist.ini
### ----------------------------------------------------
name = uniname-words
[ReadmeFromPod]
; enable = false
filename = doc/uniname-words.rakudoc
[PruneFiles]
; match = ^ 'xt/'
[Badges]
provider = github-actions/linux.yml
provider = github-actions/macos.yml
provider = github-actions/windows.yml
[UploadToZef]
|
### ----------------------------------------------------
### -- uniname-words
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: t/01-basic.rakutest
### ----------------------------------------------------
use Test;
use uniname-words;
plan 21;
ok uniname-words.elems > 1, 'did we get something actually';
for
uniname-words<love>,
uniname-words(<love>),
uniname-words(/ << love >> /)
-> @loves {
ok @loves.elems, "There are @loves.elems() words with 'LOVE' in them";
is @loves.elems,
@loves.grep(*.uniname.contains(/ << LOVE >> /)).elems,
"all @loves.elems() code points have indeed a word 'LOVE' in them";
}
for
uniname-words(<love>, :partial),
uniname-words(/ love /)
-> @loves {
ok @loves.elems, "There are @loves.elems() strings with 'LOVE' in them";
is @loves.elems,
@loves.grep(*.uniname.contains("LOVE")).elems,
"all @loves.elems() code points have indeed a string 'LOVE' in them";
}
diag uniname-words<reserved>.elems
unless ok uniname-words<reserved>.elems > 800000, 'enough reserved elements';
diag uniname-words<control>.elems
unless ok uniname-words<control>.elems > 70, 'enough control elements';
for <LEFT BRACKET>.item -> @words {
if uniname-words(@words) -> @brackets {
ok @brackets.elems, 'there are words with LEFT and BRACKET';
is @brackets.elems,
@brackets.grep(
*.uniname.contains(/ << LEFT >> / & / << BRACKET >> /)
).elems,
"all @brackets.elems() code points have both word LEFT and BRACKET";
}
if uniname-words(@words, :partial) -> @brackets {
ok @brackets.elems, 'there are strings with LEFT and BRACKET';
is @brackets.elems,
@brackets.grep(
*.uniname.contains(/ LEFT / & / BRACKET /)
).elems,
"all @brackets.elems() code points have both string LEFT and BRACKET";
}
if uniname-words(@words, :any) -> @brackets {
ok @brackets.elems, 'there are words with LEFT or BRACKET';
is @brackets.elems,
@brackets.grep(
*.uniname.contains(/ << LEFT >> / | / << BRACKET >> /)
).elems,
"all @brackets.elems() code points have either word LEFT or BRACKET";
}
if uniname-words(@words, :partial, :any) -> @brackets {
ok @brackets.elems, 'there are strings with LEFT or BRACKET';
is @brackets.elems,
@brackets.grep(
*.uniname.contains(/ LEFT | BRACKET /)
).elems,
"all @brackets.elems() code points have either string LEFT or BRACKET";
}
}
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- uniname-words
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: xt/coverage.rakutest
### ----------------------------------------------------
use Test::Coverage;
must-be-complete;
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- uniname-words
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: lib/uniname-words.rakumod
### ----------------------------------------------------
# The main "database"
my $words;
my %uniname-words := BEGIN {
use nqp;
my int32 @reserved;
my $uniname-words := nqp::hash('reserved',@reserved);
for 0..0x10FFFF -> int32 $cp { # UNCOVERABLE
my $uniname := $cp.uniname;
if $uniname.starts-with('<reserved') { # UNCOVERABLE
nqp::push_i(@reserved,$cp);
}
else {
for $uniname.comb(/ \w+ /).unique -> str $word { # UNCOVERABLE
nqp::push_i(
nqp::ifnull(
nqp::atkey($uniname-words,nqp::lc($word)),
nqp::bindkey($uniname-words,nqp::lc($word),my int32 @)
),
$cp
);
}
}
}
my $map := nqp::p6bindattrinvres(
nqp::create(Map),Map,'$!storage',$uniname-words
);
# this *must* be an assignment, as this runs in a BEGIN block
$words = "\0" ~ $map.keys.sort.join("\0") ~ "\0"; # UNCOVERABLE
$map
}
# Return the word(s) of which the given string is a part
my sub string2words($STRING) {
my $string := $STRING.trim.lc;
my int $index;
my str @words;
while $words.index($string,$index) -> int $this { # cannot be 0
my int $left = $words.rindex("\0",$this) + 1;
my int $right = $words.index("\0", $this);
@words.push: $words.substr($left, $right - $left);
$index = $right + 1; # UNCOVERABLE
}
@words
}
my sub strings2words(@strings) {
@strings.map({ string2words($_).Slip }).unique
}
my proto sub uniname-words(|) is export {*}
my multi sub uniname-words() { %uniname-words }
my multi sub uniname-words(Str:D $word) {
%uniname-words{$word.lc} // my int32 @
}
my multi sub uniname-words(+@WORDS, :$any) {
my int32 @seen;
if $any {
@seen = @WORDS.map({ .Slip with uniname-words(.lc) }).unique;
}
elsif @WORDS.map({ $_ ~~ Regex ?? $_ !! $_ ?? .lc !! Empty }) -> @words {
my %seen is Bag = @words.map: { .Slip with uniname-words($_) }
my $nr-words := @words.elems;
@seen = %seen.map({ .key if .value == $nr-words });
}
@seen.sort
}
my multi sub uniname-words(Str:D $WORD, :$partial!) {
if $WORD && $partial {
my $word := $WORD.lc;
my int32 @seen;
@seen.append($_) for string2words($word).map: { %uniname-words{$_} }
@seen.sort
}
else {
uniname-words($WORD)
}
}
my multi sub uniname-words(+@WORDS, :$partial!, :$any) {
if $partial {
my int32 @seen;
if @WORDS.map({ .lc if $_ }) -> @words {
if $any {
@seen = strings2words(@words).map({
%uniname-words{$_}.Slip
}).unique;
}
else {
my %seen is Bag = strings2words(@words).map: {
%uniname-words{$_}.Slip
}
my $nr-words := @words.elems;
my $all-words := @words.all;
@seen = %seen.map: {
.key
if .value == $nr-words
&& .key.uniname.lc.contains($all-words)
}
}
}
@seen.sort
}
else {
uniname-words(@WORDS, :$any)
}
}
my $match;
my multi sub uniname-words(Regex:D $regex) {
without $match {
use nqp;
use Map::Match:ver<0.0.8+>:auth<zef:lizmat>;
$match := nqp::create(Map::Match); # UNCOVERABLE
nqp::bindattr($match,Map::Match,'%!map',%uniname-words);
nqp::bindattr($match,Map::Match,'$!keys',nqp::decont($words));
}
my int32 @seen;
@seen.append($_) for $match.AT-KEY($regex.raku.lc.EVAL);
@seen.sort
}
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- uniprop
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: META6.json
### ----------------------------------------------------
{
"auth": "zef:lizmat",
"authors": [
"Elizabeth Mattijsen"
],
"build-depends": [
],
"depends": [
],
"description": "Provide uniprop- subs",
"license": "Artistic-2.0",
"name": "uniprop",
"perl": "6.d",
"provides": {
"uniprop": "lib/uniprop.rakumod"
},
"resources": [
],
"source-url": "https://github.com/lizmat/uniprop.git",
"tags": [
"UNICODE"
],
"test-depends": [
],
"version": "0.0.2"
}
|
### ----------------------------------------------------
### -- uniprop
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: LICENSE
### ----------------------------------------------------
The Artistic License 2.0
Copyright (c) 2000-2006, The Perl Foundation.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
This license establishes the terms under which a given free software
Package may be copied, modified, distributed, and/or redistributed.
The intent is that the Copyright Holder maintains some artistic
control over the development of that Package while still keeping the
Package available as open source and free software.
You are always permitted to make arrangements wholly outside of this
license directly with the Copyright Holder of a given Package. If the
terms of this license do not permit the full use that you propose to
make of the Package, you should contact the Copyright Holder and seek
a different licensing arrangement.
Definitions
"Copyright Holder" means the individual(s) or organization(s)
named in the copyright notice for the entire Package.
"Contributor" means any party that has contributed code or other
material to the Package, in accordance with the Copyright Holder's
procedures.
"You" and "your" means any person who would like to copy,
distribute, or modify the Package.
"Package" means the collection of files distributed by the
Copyright Holder, and derivatives of that collection and/or of
those files. A given Package may consist of either the Standard
Version, or a Modified Version.
"Distribute" means providing a copy of the Package or making it
accessible to anyone else, or in the case of a company or
organization, to others outside of your company or organization.
"Distributor Fee" means any fee that you charge for Distributing
this Package or providing support for this Package to another
party. It does not mean licensing fees.
"Standard Version" refers to the Package if it has not been
modified, or has been modified only in ways explicitly requested
by the Copyright Holder.
"Modified Version" means the Package, if it has been changed, and
such changes were not explicitly requested by the Copyright
Holder.
"Original License" means this Artistic License as Distributed with
the Standard Version of the Package, in its current version or as
it may be modified by The Perl Foundation in the future.
"Source" form means the source code, documentation source, and
configuration files for the Package.
"Compiled" form means the compiled bytecode, object code, binary,
or any other form resulting from mechanical transformation or
translation of the Source form.
Permission for Use and Modification Without Distribution
(1) You are permitted to use the Standard Version and create and use
Modified Versions for any purpose without restriction, provided that
you do not Distribute the Modified Version.
Permissions for Redistribution of the Standard Version
(2) You may Distribute verbatim copies of the Source form of the
Standard Version of this Package in any medium without restriction,
either gratis or for a Distributor Fee, provided that you duplicate
all of the original copyright notices and associated disclaimers. At
your discretion, such verbatim copies may or may not include a
Compiled form of the Package.
(3) You may apply any bug fixes, portability changes, and other
modifications made available from the Copyright Holder. The resulting
Package will still be considered the Standard Version, and as such
will be subject to the Original License.
Distribution of Modified Versions of the Package as Source
(4) You may Distribute your Modified Version as Source (either gratis
or for a Distributor Fee, and with or without a Compiled form of the
Modified Version) provided that you clearly document how it differs
from the Standard Version, including, but not limited to, documenting
any non-standard features, executables, or modules, and provided that
you do at least ONE of the following:
(a) make the Modified Version available to the Copyright Holder
of the Standard Version, under the Original License, so that the
Copyright Holder may include your modifications in the Standard
Version.
(b) ensure that installation of your Modified Version does not
prevent the user installing or running the Standard Version. In
addition, the Modified Version must bear a name that is different
from the name of the Standard Version.
(c) allow anyone who receives a copy of the Modified Version to
make the Source form of the Modified Version available to others
under
(i) the Original License or
(ii) a license that permits the licensee to freely copy,
modify and redistribute the Modified Version using the same
licensing terms that apply to the copy that the licensee
received, and requires that the Source form of the Modified
Version, and of any works derived from it, be made freely
available in that license fees are prohibited but Distributor
Fees are allowed.
Distribution of Compiled Forms of the Standard Version
or Modified Versions without the Source
(5) You may Distribute Compiled forms of the Standard Version without
the Source, provided that you include complete instructions on how to
get the Source of the Standard Version. Such instructions must be
valid at the time of your distribution. If these instructions, at any
time while you are carrying out such distribution, become invalid, you
must provide new instructions on demand or cease further distribution.
If you provide valid instructions or cease distribution within thirty
days after you become aware that the instructions are invalid, then
you do not forfeit any of your rights under this license.
(6) You may Distribute a Modified Version in Compiled form without
the Source, provided that you comply with Section 4 with respect to
the Source of the Modified Version.
Aggregating or Linking the Package
(7) You may aggregate the Package (either the Standard Version or
Modified Version) with other packages and Distribute the resulting
aggregation provided that you do not charge a licensing fee for the
Package. Distributor Fees are permitted, and licensing fees for other
components in the aggregation are permitted. The terms of this license
apply to the use and Distribution of the Standard or Modified Versions
as included in the aggregation.
(8) You are permitted to link Modified and Standard Versions with
other works, to embed the Package in a larger work of your own, or to
build stand-alone binary or bytecode versions of applications that
include the Package, and Distribute the result without restriction,
provided the result does not expose a direct interface to the Package.
Items That are Not Considered Part of a Modified Version
(9) Works (including, but not limited to, modules and scripts) that
merely extend or make use of the Package, do not, by themselves, cause
the Package to be a Modified Version. In addition, such works are not
considered parts of the Package itself, and are not subject to the
terms of this license.
General Provisions
(10) Any use, modification, and distribution of the Standard or
Modified Versions is governed by this Artistic License. By using,
modifying or distributing the Package, you accept this license. Do not
use, modify, or distribute the Package, if you do not accept this
license.
(11) If your Modified Version has been derived from a Modified
Version made by someone other than you, you are nevertheless required
to ensure that your Modified Version complies with the requirements of
this license.
(12) This license does not grant you the right to use any trademark,
service mark, tradename, or logo of the Copyright Holder.
(13) This license includes the non-exclusive, worldwide,
free-of-charge patent license to make, have made, use, offer to sell,
sell, import and otherwise transfer the Package with respect to any
patent claims licensable by the Copyright Holder that are necessarily
infringed by the Package. If you institute patent litigation
(including a cross-claim or counterclaim) against any party alleging
that the Package constitutes direct or contributory patent
infringement, then this Artistic License to you shall terminate on the
date that such litigation is filed.
(14) Disclaimer of Warranty:
THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL
LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
### ----------------------------------------------------
### -- uniprop
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: README.md
### ----------------------------------------------------
[](https://github.com/lizmat/uniprop/actions)
NAME
====
uniprop - Provide uniprop- subs
SYNOPSIS
========
```raku
use uniprop; # provide uniprop-int, uniprop-bool, unitprop-str
```
DESCRIPTION
===========
The `uniprop` distribution provides 3 subroutines that used to live in the Rakudo core, but were in fact implementation detail / used for testing by core developers only. These have since then been removed from Rakudo.
This distribution has captured the code of these subroutines and will export them in any version of Rakudo that has them removed.
No further documentation is provided, as originally no additional documentation was provided and it was never the intention to expose this functionality this way.
AUTHOR
======
Elizabeth Mattijsen <[email protected]>
Source can be located at: https://github.com/lizmat/uniprop . 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 2022, 2024 Elizabeth Mattijsen
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
|
### ----------------------------------------------------
### -- uniprop
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: dist.ini
### ----------------------------------------------------
name = uniprop
[ReadmeFromPod]
; enable = false
filename = lib/uniprop.rakumod
[UploadToZef]
[PruneFiles]
; match = ^ 'xt/'
[Badges]
provider = github-actions/test
|
### ----------------------------------------------------
### -- uniprop
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: t/01-basic.rakutest
### ----------------------------------------------------
use Test;
use uniprop;
plan 3;
ok ::("&uniprop-$_"), "did we get &uniprop-$_"
for <int bool str>;
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- uniprop
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: lib/uniprop.rakumod
### ----------------------------------------------------
# Hooks for export
my ∫
my &bool;
my &str;
#-------------------------------------------------------------------------------
my constant MoarVM = Q:to/CODE/;
use nqp;
&int = proto sub uniprop-int(|) {*}
multi sub uniprop-int(Str:D $str, Stringy:D $propname) {
$str ?? uniprop-int($str.ord, $propname) !! Nil }
multi sub uniprop-int(Int:D $code, Stringy:D $propname) {
nqp::getuniprop_int($code,nqp::unipropcode($propname));
}
&bool = proto sub uniprop-bool(|) {*}
multi sub uniprop-bool(Str:D $str, Stringy:D $propname) {
$str ?? uniprop-bool($str.ord, $propname) !! Nil
}
multi sub uniprop-bool(Int:D $code, Stringy:D $propname) {
nqp::hllbool(nqp::getuniprop_bool($code,nqp::unipropcode($propname)));
}
&str = proto sub uniprop-str(|) {*}
multi sub uniprop-str(Str:D $str, Stringy:D $propname) {
$str ?? uniprop-str($str.ord, $propname) !! Nil
}
multi sub uniprop-str(Int:D $code, Stringy:D $propname) {
nqp::getuniprop_str($code,nqp::unipropcode($propname));
}
CODE
#-------------------------------------------------------------------------------
my constant JVM = Q:to/CODE/;
&int = sub uniprop-int(|) { die 'uniprop-int NYI on jvm backend' }
&bool = sub uniprop-bool(|) { die 'uniprop-bool NYI on jvm backend' }
&str = sub uniprop-str(|) { die 'uniprop-str NYI on jvm backend' }
CODE
#-------------------------------------------------------------------------------
my constant JS = Q:to/CODE/;
&int = sub uniprop-int(|) { die 'uniprop-int NYI on js backend' }
&bool = sub uniprop-bool(|) { die 'uniprop-bool NYI on js backend' }
use nqp;
&str = proto sub uniprop-str(|) {*}
multi sub uniprop-str(Str:D $str, Stringy:D $propname) {
$str ?? uniprop-str($str.ord, $propname) !! Nil
}
multi sub uniprop-str(Int:D $code, Stringy:D $propname) {
nqp::getuniprop_str($code,nqp::unipropcode($propname));
}
CODE
#-------------------------------------------------------------------------------
BEGIN {
unless ::("&uniprop-int") {
given $*VM.name {
when "moar" { MoarVM.EVAL }
when "jvm" { JVM.EVAL }
when "js" { JS.EVAL }
default {
die "Unexpected backend name: $_"
}
}
}
}
#-------------------------------------------------------------------------------
sub EXPORT() {
::("&uniprop-int")
?? Map.new()
!! Map.new:
'&uniprop-int' => &int<>,
'&uniprop-bool' => &bool<>,
'&uniprop-str' => &str<>,
}
=begin pod
=head1 NAME
uniprop - Provide uniprop- subs
=head1 SYNOPSIS
=begin code :lang<raku>
use uniprop; # provide uniprop-int, uniprop-bool, unitprop-str
=end code
=head1 DESCRIPTION
The C<uniprop> distribution provides 3 subroutines that used to live in
the Rakudo core, but were in fact implementation detail / used for testing
by core developers only. These have since then been removed from Rakudo.
This distribution has captured the code of these subroutines and will export
them in any version of Rakudo that has them removed.
No further documentation is provided, as originally no additional documentation
was provided and it was never the intention to expose this functionality this
way.
=head1 AUTHOR
Elizabeth Mattijsen <[email protected]>
Source can be located at: https://github.com/lizmat/uniprop . Comments and
Pull Requests are welcome.
If you like this module, or what I’m doing more generally, committing to a
L<small sponsorship|https://github.com/sponsors/lizmat/> would mean a great
deal to me!
=head1 COPYRIGHT AND LICENSE
Copyright 2022, 2024 Elizabeth Mattijsen
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
=end pod
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- unprint
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: META6.json
### ----------------------------------------------------
{
"auth": "zef:lizmat",
"authors": [
"Elizabeth Mattijsen"
],
"build-depends": [
],
"depends": [
],
"description": "provide fast print / say / put",
"license": "Artistic-2.0",
"name": "unprint",
"perl": "6.c",
"provides": {
"unprint": "lib/unprint.rakumod"
},
"resources": [
],
"source-url": "https://github.com/lizmat/unprint.git",
"tags": [
"UTILS",
"PRINT",
"FASTER",
"NAUGHT"
],
"test-depends": [
],
"version": "0.0.6"
}
|
### ----------------------------------------------------
### -- unprint
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: LICENSE
### ----------------------------------------------------
The Artistic License 2.0
Copyright (c) 2000-2006, The Perl Foundation.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
This license establishes the terms under which a given free software
Package may be copied, modified, distributed, and/or redistributed.
The intent is that the Copyright Holder maintains some artistic
control over the development of that Package while still keeping the
Package available as open source and free software.
You are always permitted to make arrangements wholly outside of this
license directly with the Copyright Holder of a given Package. If the
terms of this license do not permit the full use that you propose to
make of the Package, you should contact the Copyright Holder and seek
a different licensing arrangement.
Definitions
"Copyright Holder" means the individual(s) or organization(s)
named in the copyright notice for the entire Package.
"Contributor" means any party that has contributed code or other
material to the Package, in accordance with the Copyright Holder's
procedures.
"You" and "your" means any person who would like to copy,
distribute, or modify the Package.
"Package" means the collection of files distributed by the
Copyright Holder, and derivatives of that collection and/or of
those files. A given Package may consist of either the Standard
Version, or a Modified Version.
"Distribute" means providing a copy of the Package or making it
accessible to anyone else, or in the case of a company or
organization, to others outside of your company or organization.
"Distributor Fee" means any fee that you charge for Distributing
this Package or providing support for this Package to another
party. It does not mean licensing fees.
"Standard Version" refers to the Package if it has not been
modified, or has been modified only in ways explicitly requested
by the Copyright Holder.
"Modified Version" means the Package, if it has been changed, and
such changes were not explicitly requested by the Copyright
Holder.
"Original License" means this Artistic License as Distributed with
the Standard Version of the Package, in its current version or as
it may be modified by The Perl Foundation in the future.
"Source" form means the source code, documentation source, and
configuration files for the Package.
"Compiled" form means the compiled bytecode, object code, binary,
or any other form resulting from mechanical transformation or
translation of the Source form.
Permission for Use and Modification Without Distribution
(1) You are permitted to use the Standard Version and create and use
Modified Versions for any purpose without restriction, provided that
you do not Distribute the Modified Version.
Permissions for Redistribution of the Standard Version
(2) You may Distribute verbatim copies of the Source form of the
Standard Version of this Package in any medium without restriction,
either gratis or for a Distributor Fee, provided that you duplicate
all of the original copyright notices and associated disclaimers. At
your discretion, such verbatim copies may or may not include a
Compiled form of the Package.
(3) You may apply any bug fixes, portability changes, and other
modifications made available from the Copyright Holder. The resulting
Package will still be considered the Standard Version, and as such
will be subject to the Original License.
Distribution of Modified Versions of the Package as Source
(4) You may Distribute your Modified Version as Source (either gratis
or for a Distributor Fee, and with or without a Compiled form of the
Modified Version) provided that you clearly document how it differs
from the Standard Version, including, but not limited to, documenting
any non-standard features, executables, or modules, and provided that
you do at least ONE of the following:
(a) make the Modified Version available to the Copyright Holder
of the Standard Version, under the Original License, so that the
Copyright Holder may include your modifications in the Standard
Version.
(b) ensure that installation of your Modified Version does not
prevent the user installing or running the Standard Version. In
addition, the Modified Version must bear a name that is different
from the name of the Standard Version.
(c) allow anyone who receives a copy of the Modified Version to
make the Source form of the Modified Version available to others
under
(i) the Original License or
(ii) a license that permits the licensee to freely copy,
modify and redistribute the Modified Version using the same
licensing terms that apply to the copy that the licensee
received, and requires that the Source form of the Modified
Version, and of any works derived from it, be made freely
available in that license fees are prohibited but Distributor
Fees are allowed.
Distribution of Compiled Forms of the Standard Version
or Modified Versions without the Source
(5) You may Distribute Compiled forms of the Standard Version without
the Source, provided that you include complete instructions on how to
get the Source of the Standard Version. Such instructions must be
valid at the time of your distribution. If these instructions, at any
time while you are carrying out such distribution, become invalid, you
must provide new instructions on demand or cease further distribution.
If you provide valid instructions or cease distribution within thirty
days after you become aware that the instructions are invalid, then
you do not forfeit any of your rights under this license.
(6) You may Distribute a Modified Version in Compiled form without
the Source, provided that you comply with Section 4 with respect to
the Source of the Modified Version.
Aggregating or Linking the Package
(7) You may aggregate the Package (either the Standard Version or
Modified Version) with other packages and Distribute the resulting
aggregation provided that you do not charge a licensing fee for the
Package. Distributor Fees are permitted, and licensing fees for other
components in the aggregation are permitted. The terms of this license
apply to the use and Distribution of the Standard or Modified Versions
as included in the aggregation.
(8) You are permitted to link Modified and Standard Versions with
other works, to embed the Package in a larger work of your own, or to
build stand-alone binary or bytecode versions of applications that
include the Package, and Distribute the result without restriction,
provided the result does not expose a direct interface to the Package.
Items That are Not Considered Part of a Modified Version
(9) Works (including, but not limited to, modules and scripts) that
merely extend or make use of the Package, do not, by themselves, cause
the Package to be a Modified Version. In addition, such works are not
considered parts of the Package itself, and are not subject to the
terms of this license.
General Provisions
(10) Any use, modification, and distribution of the Standard or
Modified Versions is governed by this Artistic License. By using,
modifying or distributing the Package, you accept this license. Do not
use, modify, or distribute the Package, if you do not accept this
license.
(11) If your Modified Version has been derived from a Modified
Version made by someone other than you, you are nevertheless required
to ensure that your Modified Version complies with the requirements of
this license.
(12) This license does not grant you the right to use any trademark,
service mark, tradename, or logo of the Copyright Holder.
(13) This license includes the non-exclusive, worldwide,
free-of-charge patent license to make, have made, use, offer to sell,
sell, import and otherwise transfer the Package with respect to any
patent claims licensable by the Copyright Holder that are necessarily
infringed by the Package. If you institute patent litigation
(including a cross-claim or counterclaim) against any party alleging
that the Package constitutes direct or contributory patent
infringement, then this Artistic License to you shall terminate on the
date that such litigation is filed.
(14) Disclaimer of Warranty:
THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL
LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
### ----------------------------------------------------
### -- unprint
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: README.md
### ----------------------------------------------------
[](https://github.com/lizmat/unprint/actions) [](https://github.com/lizmat/unprint/actions) [](https://github.com/lizmat/unprint/actions)
NAME
====
unprint - provide fast print / say / put
SYNOPSIS
========
```raku
use unprint;
print "foo";
say "bar";
put 42;
```
DESCRIPTION
===========
This module provides fast `print`, `say` and `put` subroutines that will directly write to STDOUT of the OS without any overhead caused by determining which `$*OUT` to actually use.
AUTHOR
======
Elizabeth Mattijsen <[email protected]>
Source can be located at: https://github.com/lizmat/unprint . Comments and Pull Requests are welcome.
If you like this module, or what I'm doing more generally, committing to a [small sponsorship](https://github.com/sponsors/lizmat/) would mean a great deal to me!
COPYRIGHT AND LICENSE
=====================
Copyright 2018, 2020, 2021, 2024, 2025 Elizabeth Mattijsen
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
|
### ----------------------------------------------------
### -- unprint
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: dist.ini
### ----------------------------------------------------
name = unprint
[ReadmeFromPod]
; enable = false
filename = doc/unprint.rakudoc
[PruneFiles]
; match = ^ 'xt/'pm6
[Badges]
provider = github-actions/linux.yml
provider = github-actions/macos.yml
provider = github-actions/windows.yml
[UploadToZef]
|
### ----------------------------------------------------
### -- unprint
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: t/01-basic.rakutest
### ----------------------------------------------------
use Test;
plan 7;
for (
"print q/hello/", "hello",
"print q/hello/,q/world/", "helloworld",
"say q/hello/", "hello\n",
"say q/hello/,q/world/", "helloworld\n",
"say Int", "(Int)\n",
"say Int, Str", "(Int)(Str)\n",
"put (1,2)", "1 2\n",
) -> $string, $expected {
my $output = run(
$*EXECUTABLE, '-I', 'lib', '-M', 'unprint', '-e', $string, :out
).out.slurp;
is $output, $expected, "did '$string' give '$expected'";
}
# vim: expandtab sw=4
|
### ----------------------------------------------------
### -- unprint
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: xt/coverage.rakutest
### ----------------------------------------------------
use Test::Coverage;
plan 2;
todo "needs more tests";
coverage-at-least 75;
todo "needs more tests";
uncovered-at-most 1;
source-with-coverage;
report;
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- unprint
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: lib/unprint.rakumod
### ----------------------------------------------------
# We need nqp ops everywhere here, so make it global
use nqp;
proto sub print(|) is export {*}
multi sub print(str $s) { nqp::print($s) }
multi sub print(Str:D $s) { nqp::print($s) }
multi sub print($s) { nqp::print($s.Str) }
multi sub print(*@s) { nqp::print(@s.join) }
proto sub say(|) is export {*}
multi sub say(str $s) { nqp::say($s) }
multi sub say(Str:D $s) { nqp::say($s) }
multi sub say($s) { nqp::say($s.gist) }
multi sub say(*@s) { nqp::say(@s>>.gist.join) }
proto sub put(|) is export {*}
multi sub put(str $s) { nqp::say($s) }
multi sub put(Str:D $s) { nqp::say($s) }
multi sub put($s) { nqp::say($s.Str) }
multi sub put(*@s) { nqp::say(@s.join) }
=begin pod
=head1 NAME
unprint - provide fast print / say / put
=head1 SYNOPSIS
=begin code :lang<raku>
use unprint;
print "foo";
say "bar";
put 42;
=end code
=head1 DESCRIPTION
This module provides fast C<print>, C<say> and C<put> subroutines that will
directly write to STDOUT of the OS without any overhead caused by determining
which C<$*OUT> to actually use.
=head1 AUTHOR
Elizabeth Mattijsen <[email protected]>
Source can be located at: https://github.com/lizmat/unprint . Comments and
Pull Requests are welcome.
If you like this module, or what I'm doing more generally, committing to a
L<small sponsorship|https://github.com/sponsors/lizmat/> would mean a great
deal to me!
=head1 COPYRIGHT AND LICENSE
Copyright 2018, 2020, 2021, 2024 Elizabeth Mattijsen
This library is free software; you can redistribute it and/or modify it under
the Artistic License 2.0.
=end pod
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- vCard::Parser
### -- Licenses: Artistic-2.0
### -- Authors: Petr Kolář
### -- File: META6.json
### ----------------------------------------------------
{
"auth": "zef:raku-community-modules",
"authors": [
"Petr Kolář"
],
"build-depends": [
],
"depends": [
],
"description": "a basic parser of vCard",
"license": "Artistic-2.0",
"name": "vCard::Parser",
"perl": "6.d",
"provides": {
"vCard::Parser": "lib/vCard/Parser.rakumod",
"vCard::Parser::Actions": "lib/vCard/Parser/Actions.rakumod",
"vCard::Parser::Grammar": "lib/vCard/Parser/Grammar.rakumod"
},
"resources": [
],
"source-url": "https://github.com/raku-community-modules/vCard-Parser.git",
"tags": [
"Grammar",
"Parse",
"Parsing",
"Parser"
],
"test-depends": [
"JSON::Tiny"
],
"version": "0.0.2"
}
|
### ----------------------------------------------------
### -- vCard::Parser
### -- Licenses: Artistic-2.0
### -- Authors: Petr Kolář
### -- File: LICENSE
### ----------------------------------------------------
The Artistic License 2.0
Copyright (c) 2000-2006, The Perl Foundation.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
This license establishes the terms under which a given free software
Package may be copied, modified, distributed, and/or redistributed.
The intent is that the Copyright Holder maintains some artistic
control over the development of that Package while still keeping the
Package available as open source and free software.
You are always permitted to make arrangements wholly outside of this
license directly with the Copyright Holder of a given Package. If the
terms of this license do not permit the full use that you propose to
make of the Package, you should contact the Copyright Holder and seek
a different licensing arrangement.
Definitions
"Copyright Holder" means the individual(s) or organization(s)
named in the copyright notice for the entire Package.
"Contributor" means any party that has contributed code or other
material to the Package, in accordance with the Copyright Holder's
procedures.
"You" and "your" means any person who would like to copy,
distribute, or modify the Package.
"Package" means the collection of files distributed by the
Copyright Holder, and derivatives of that collection and/or of
those files. A given Package may consist of either the Standard
Version, or a Modified Version.
"Distribute" means providing a copy of the Package or making it
accessible to anyone else, or in the case of a company or
organization, to others outside of your company or organization.
"Distributor Fee" means any fee that you charge for Distributing
this Package or providing support for this Package to another
party. It does not mean licensing fees.
"Standard Version" refers to the Package if it has not been
modified, or has been modified only in ways explicitly requested
by the Copyright Holder.
"Modified Version" means the Package, if it has been changed, and
such changes were not explicitly requested by the Copyright
Holder.
"Original License" means this Artistic License as Distributed with
the Standard Version of the Package, in its current version or as
it may be modified by The Perl Foundation in the future.
"Source" form means the source code, documentation source, and
configuration files for the Package.
"Compiled" form means the compiled bytecode, object code, binary,
or any other form resulting from mechanical transformation or
translation of the Source form.
Permission for Use and Modification Without Distribution
(1) You are permitted to use the Standard Version and create and use
Modified Versions for any purpose without restriction, provided that
you do not Distribute the Modified Version.
Permissions for Redistribution of the Standard Version
(2) You may Distribute verbatim copies of the Source form of the
Standard Version of this Package in any medium without restriction,
either gratis or for a Distributor Fee, provided that you duplicate
all of the original copyright notices and associated disclaimers. At
your discretion, such verbatim copies may or may not include a
Compiled form of the Package.
(3) You may apply any bug fixes, portability changes, and other
modifications made available from the Copyright Holder. The resulting
Package will still be considered the Standard Version, and as such
will be subject to the Original License.
Distribution of Modified Versions of the Package as Source
(4) You may Distribute your Modified Version as Source (either gratis
or for a Distributor Fee, and with or without a Compiled form of the
Modified Version) provided that you clearly document how it differs
from the Standard Version, including, but not limited to, documenting
any non-standard features, executables, or modules, and provided that
you do at least ONE of the following:
(a) make the Modified Version available to the Copyright Holder
of the Standard Version, under the Original License, so that the
Copyright Holder may include your modifications in the Standard
Version.
(b) ensure that installation of your Modified Version does not
prevent the user installing or running the Standard Version. In
addition, the Modified Version must bear a name that is different
from the name of the Standard Version.
(c) allow anyone who receives a copy of the Modified Version to
make the Source form of the Modified Version available to others
under
(i) the Original License or
(ii) a license that permits the licensee to freely copy,
modify and redistribute the Modified Version using the same
licensing terms that apply to the copy that the licensee
received, and requires that the Source form of the Modified
Version, and of any works derived from it, be made freely
available in that license fees are prohibited but Distributor
Fees are allowed.
Distribution of Compiled Forms of the Standard Version
or Modified Versions without the Source
(5) You may Distribute Compiled forms of the Standard Version without
the Source, provided that you include complete instructions on how to
get the Source of the Standard Version. Such instructions must be
valid at the time of your distribution. If these instructions, at any
time while you are carrying out such distribution, become invalid, you
must provide new instructions on demand or cease further distribution.
If you provide valid instructions or cease distribution within thirty
days after you become aware that the instructions are invalid, then
you do not forfeit any of your rights under this license.
(6) You may Distribute a Modified Version in Compiled form without
the Source, provided that you comply with Section 4 with respect to
the Source of the Modified Version.
Aggregating or Linking the Package
(7) You may aggregate the Package (either the Standard Version or
Modified Version) with other packages and Distribute the resulting
aggregation provided that you do not charge a licensing fee for the
Package. Distributor Fees are permitted, and licensing fees for other
components in the aggregation are permitted. The terms of this license
apply to the use and Distribution of the Standard or Modified Versions
as included in the aggregation.
(8) You are permitted to link Modified and Standard Versions with
other works, to embed the Package in a larger work of your own, or to
build stand-alone binary or bytecode versions of applications that
include the Package, and Distribute the result without restriction,
provided the result does not expose a direct interface to the Package.
Items That are Not Considered Part of a Modified Version
(9) Works (including, but not limited to, modules and scripts) that
merely extend or make use of the Package, do not, by themselves, cause
the Package to be a Modified Version. In addition, such works are not
considered parts of the Package itself, and are not subject to the
terms of this license.
General Provisions
(10) Any use, modification, and distribution of the Standard or
Modified Versions is governed by this Artistic License. By using,
modifying or distributing the Package, you accept this license. Do not
use, modify, or distribute the Package, if you do not accept this
license.
(11) If your Modified Version has been derived from a Modified
Version made by someone other than you, you are nevertheless required
to ensure that your Modified Version complies with the requirements of
this license.
(12) This license does not grant you the right to use any trademark,
service mark, tradename, or logo of the Copyright Holder.
(13) This license includes the non-exclusive, worldwide,
free-of-charge patent license to make, have made, use, offer to sell,
sell, import and otherwise transfer the Package with respect to any
patent claims licensable by the Copyright Holder that are necessarily
infringed by the Package. If you institute patent litigation
(including a cross-claim or counterclaim) against any party alleging
that the Package constitutes direct or contributory patent
infringement, then this Artistic License to you shall terminate on the
date that such litigation is filed.
(14) Disclaimer of Warranty:
THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL
LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
### ----------------------------------------------------
### -- vCard::Parser
### -- Licenses: Artistic-2.0
### -- Authors: Petr Kolář
### -- File: README.md
### ----------------------------------------------------
[](https://github.com/raku-community-modules/vCard-Parser/actions) [](https://github.com/raku-community-modules/vCard-Parser/actions) [](https://github.com/raku-community-modules/vCard-Parser/actions)
NAME
====
vCard::Parser - a basic parser of vCard
SYNOPSIS
========
```perl6
use vCard::Parser;
my $vcard = 'BEGIN:VCARD
VERSION:4.0
N:Gump;Forrest;;Mr.;
x-qq:21588891
END:VCARD';
say from-vCard($vcard);
use JSON::Tiny;
say to-json(from-vCard($vcard)); #Output is jCard
```
DESCRIPTION
===========
vCard::Parser is a basic parser of vCard files of version 4.0. It also serves as it's convertor to jCard, which is a JSON format for vCard data.
AUTHOR
======
Petr Kolář
COPYRIGHT AND LICENSE
=====================
Copyright 2019 Petr Kolář
Copyright 2024 Raku Community
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
|
### ----------------------------------------------------
### -- vCard::Parser
### -- Licenses: Artistic-2.0
### -- Authors: Petr Kolář
### -- File: dist.ini
### ----------------------------------------------------
name = vCard-Parser
[ReadmeFromPod]
; enable = false
filename = lib/vCard/Parser.rakumod
[PruneFiles]
; match = ^ 'xt/'
[UploadToZef]
[Badges]
provider = github-actions/linux.yml
provider = github-actions/macos.yml
provider = github-actions/windows.yml
|
### ----------------------------------------------------
### -- vCard::Parser
### -- Licenses: Artistic-2.0
### -- Authors: Petr Kolář
### -- File: t/01-basic.rakutest
### ----------------------------------------------------
use Test;
plan 1;
use-ok 'vCard::Parser';
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- vCard::Parser
### -- Licenses: Artistic-2.0
### -- Authors: Petr Kolář
### -- File: t/03-actions.rakutest
### ----------------------------------------------------
use Test;
use vCard::Parser::Grammar;
use vCard::Parser::Actions;
use JSON::Tiny;
plan 9;
my $grammar = vCard::Parser::Grammar.new;
my $action = vCard::Parser::Actions.new;
role Do-made {
method made {self};
};
isa-ok $action.made-value([1 but Do-made,2 but Do-made]), "Array";
isa-ok $action.made-value([1 but Do-made]), 'Int';
my $jCard-multi-value = from-json '["adr", {}, "text",
[
"", "",
["My Street", "Left Side", "Second Shack"],
"Hometown", "PA", "18252", "U.S.A."
]
]';
cmp-ok $grammar.parse($_, actions => $action.new, :rule<content-line>).made, 'eqv', $jCard-multi-value, 'Equality testing - jCard from-json contains an array in property-value' with 'ADR:;;My Street,Left Side,Second Shack;Hometown;PA;18252;U.S.A.';
is-deeply $grammar.parse($_, actions => $action.new, :rule<parameter>).made, 'type' => <work voice>.Array, 'Parameter TYPE was converted to lowercase and its value is hashArray of values: work, voice' with 'TYPE=work,voice';
is-deeply $grammar.parse($_, actions => $action.new, :rule<content-line>).made, $["tel", {:type($["work", "voice"])}, "uri", "tel:+1-111-555-1212"], 'The structure of content-line is following: string-tel, hashArray-type, string-uri, string-value' with 'TEL;TYPE=work,voice;VALUE=uri:tel:+1-111-555-1212';
is $grammar.parse($_, actions => $action.new, :rule<property-value>).made, 'United, States; of A\\merica', 'Formating property-value - testing whether allowed backslashed characters were modified correctly' with 'United\, States\; of A\\merica';
is-deeply $grammar.parsefile('./t/test-cards/test-card1.vcard', actions => $action.new, :rule<vcard>).made, from-json(slurp './t/test-cards/test-card3.jcard'), 'The comparsion of test-card3.jcard from-json and expected result - test-card1.vcard.';
is $grammar.parse($_, actions => $action.new, :rule<content-line>).made[1], "${:group("MyGroup")}", 'Jcard contains a group parameter' with 'MyGroup.ORG:Bubba Gump Shrimp Co.';
subtest 'Testing types of property-value.', {
plan 6;
my %type-of-property-value = %(
'x-qq:21588891' => 'unknown',
'group.X-prop:tel:454' => 'unknown',
'TEL;TYPE=work,voice;VALUE=uri:tel:+1-111-555-1212' => 'uri',
'EMAIL;PID=4.2,5.1:[email protected]' => 'text',
'EMAIL;PID=4.2,5.1;VALUE=date:[email protected]' => 'date',
'ANNIVERSARY:20090808T1430-0500' => 'date-and-or-time',
);
for %type-of-property-value.pairs {
is my $tmp = $grammar.parse($_.key, actions => $action.new, :rule<content-line>).made[2], $_.value, "A type of property-value for: $/ is: $tmp";
};
};
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- vCard::Parser
### -- Licenses: Artistic-2.0
### -- Authors: Petr Kolář
### -- File: t/02-grammar.rakutest
### ----------------------------------------------------
use Test;
use vCard::Parser::Grammar;
plan 23;
my $vcard-grammar = vCard::Parser::Grammar.new;
ok $vcard-grammar.parsefile($*PROGRAM.sibling('test-cards').add($_)),
"Testcard: \n\n$/ \n\n..........\n"
for <test-card1.vcard test-card2.vcard test-card4.vcard>;
ok $vcard-grammar.parse($_, :rule<property-name>), "A property name can be $_" for <email Email eMail n N fn fN>;
like $vcard-grammar.parse($_, :rule<content-line>).<property-value>,/^Bubba/ with 'ORG:Bubba Gump Shrimp Co.';
like $vcard-grammar.parse($_, :rule<content-line>).<property-value>,/^\d+$/ with 'x-qq:21588891';
like $vcard-grammar.parse($_, :rule<content-line>).<parameter>».<parameter-name>, /^X'-'\w+$/ with 'x-prop;X-param=val:Joseph Com.';
is $vcard-grammar.parse($_, :rule<content-line>).<property-value>».Str,('', 'Gump', 'Forrest', '', 'Mr.',''), 'Found 6 propertyValues, including 3 empty in border testing.' with 'N:;Gump;Forrest;;Mr.;';
# like $vcard-grammar.parse($_, :rule<content-line>).<value>,/\n \h+/ with 'x-qq:215
# 88891';
is $vcard-grammar.parsefile($_).<vcard>.elems, 3,"$vcard-grammar contains 3 vcards." with './t/test-cards/test-card4.vcard';
is $vcard-grammar.parsefile($_).<vcard>.elems, 1,"$vcard-grammar contains 1 vcard." with './t/test-cards/test-card2.vcard';
is $vcard-grammar.parse($_, :rule<content-line>).<group>, "MyGroup", 'Group occurance test.' with 'MyGroup.ORG;pref=5:Bubba Gump Shrimp Co.';
nok $vcard-grammar.parse($_, :rule<content-line>).<property-name>, 'Missing the property-name is not allowed.' with ';pref=1:Bubba Gump Shrimp Co.';
nok $vcard-grammar.parse($_, :rule<content-line>).<property-name>, 'Usage of non existent property-name is not allowed.' with 'preb:Bubba Gump Shrimp Co.';
nok $vcard-grammar.parse($_, :rule<content-line>).<property-value>, 'Missing the parameter-value is not allowed.' with 'MyGroup.ORG;pref=5';
is $vcard-grammar.parse($_, :rule<content-line>).<parameter>, <TYPE=work,voice VALUE=uri>, 'Found parameters: TYPE with values=work, voice; Value with value=uri.' with 'TEL;TYPE=work,voice;VALUE=uri:tel:+1-111-555-1212';
like $vcard-grammar.parse($_, :rule<content-line>).<parameter>.[0],/^TYPE/, 'First parameter-name begins with characters TYPE.' with 'ADR;TYPE=HOME;LABEL="42 Plantation St.\nBaytown\, LA 30314\nUnited States of America":;;42 Plantation St.;Baytown;LA;30314;United States of America';
cmp-ok $vcard-grammar.parse($_, :rule<property-value>).<property-simple-value>».Str, 'eqv', ["My Street", "Left Side", "Second Shack"], 'property-value makes an array with three items of a property-simple-value type' with 'My Street,Left Side,Second Shack';
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- vCard::Parser
### -- Licenses: Artistic-2.0
### -- Authors: Petr Kolář
### -- File: t/04-from-vCard.rakutest
### ----------------------------------------------------
use Test;
use vCard::Parser;
use JSON::Tiny;
plan 1;
is-deeply
from-vCard(slurp $*PROGRAM.sibling('test-cards').add('test-card1.vcard')),
from-json(slurp $*PROGRAM.sibling('test-cards').add('test-card3.jcard')),
'Testing from-vCard routine.';
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- vCard::Parser
### -- Licenses: Artistic-2.0
### -- Authors: Petr Kolář
### -- File: lib/vCard/Parser.rakumod
### ----------------------------------------------------
use vCard::Parser::Grammar;
use vCard::Parser::Actions;
unit class vCard::Parser;
sub line-folding(Str:D $_) {
.subst(/ \n [ ' ' | \t ] /, Q{}, :g);
};
sub from-vCard ($_) is export {
my $preprocessed-vcard = line-folding($_);
sub parser (|c) {vCard::Parser::Grammar.parse(|c)};
my $vcard = parser($preprocessed-vcard, actions => vCard::Parser::Actions.new);
with $vcard {
return $_.made
};
};
=begin pod
=head1 NAME
vCard::Parser - a basic parser of vCard
=head1 SYNOPSIS
=begin code :lang<perl6>
use vCard::Parser;
my $vcard = 'BEGIN:VCARD
VERSION:4.0
N:Gump;Forrest;;Mr.;
x-qq:21588891
END:VCARD';
say from-vCard($vcard);
use JSON::Tiny;
say to-json(from-vCard($vcard)); #Output is jCard
=end code
=head1 DESCRIPTION
vCard::Parser is a basic parser of vCard files of version 4.0.
It also serves as it's convertor to jCard, which is a JSON format for vCard data.
=head1 AUTHOR
Petr Kolář
=head1 COPYRIGHT AND LICENSE
Copyright 2019 Petr Kolář
Copyright 2024 Raku Community
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
=end pod
|
### ----------------------------------------------------
### -- vCard::Parser
### -- Licenses: Artistic-2.0
### -- Authors: Petr Kolář
### -- File: lib/vCard/Parser/Grammar.rakumod
### ----------------------------------------------------
unit grammar vCard::Parser::Grammar;
token TOP { <vcard>+ %% \n }
token vcard { <begin> \n <version> \n <content-line>+ %% \n <endI> };
token version { :i 'Version:4.0' };
token begin { :i 'BEGIN:VCARD' };
token endI { :i 'END:VCARD' };
token content-line { [<group> '.']? <property-name> [ ';' <parameter>]* ':' <property-value>+ % <[;]> };
token group { <.alpha-num-dash>+ };
token alpha-num-dash { \w | '-' };
token property-value { <property-simple-value>+ % ',' };
token property-simple-value { [ \\ . | <-[\n;,]> ]* };
proto token property-name {*}
token property-name:sym<source> { :i source }
token property-name:sym<kind> { :i kind }
token property-name:sym<fn> { :i fn }
token property-name:sym<n> { :i n }
token property-name:sym<nickname> { :i nickname }
token property-name:sym<photo> { :i photo }
token property-name:sym<bday> { :i bday }
token property-name:sym<anniversary> { :i anniversary }
token property-name:sym<gender> { :i gender }
token property-name:sym<adr> { :i adr }
token property-name:sym<tel> { :i tel }
token property-name:sym<email> { :i email }
token property-name:sym<impp> { :i impp }
token property-name:sym<lang> { :i lang }
token property-name:sym<tz> { :i tz }
token property-name:sym<geo> { :i geo }
token property-name:sym<title> { :i title }
token property-name:sym<role> { :i role }
token property-name:sym<logo> { :i logo }
token property-name:sym<org> { :i org }
token property-name:sym<member> { :i member }
token property-name:sym<related> { :i related }
token property-name:sym<categories> { :i categories }
token property-name:sym<note> { :i note }
token property-name:sym<prodid> { :i prodid }
token property-name:sym<rev> { :i rev }
token property-name:sym<sound> { :i sound }
token property-name:sym<uid> { :i uid }
token property-name:sym<clientpidmap> { :i clientpidmap }
token property-name:sym<url> { :i url }
token property-name:sym<key> { :i key }
token property-name:sym<fburl> { :i fburl }
token property-name:sym<caladruri> { :i caladruri }
token property-name:sym<caluri> { :i caluri }
token property-name:sym<xml> { :i xml }
token property-name:sym<birthplace> { :i birthplace }
token property-name:sym<deathplace> { :i deathplace }
token property-name:sym<deathdate> { :i deathdate }
token property-name:sym<expertise> { :i expertise }
token property-name:sym<hobby> { :i hobby }
token property-name:sym<interest> { :i interest }
token property-name:sym<org-directory> { :i org'-'directory }
token property-name:sym<x-name> { <[xX]> '-' <.alpha-num-dash>+ }
token parameter { <parameter-name> '=' <parameter-value>+ % ',' };
token parameter-value { <q-safe-char> | <safe-char> };
token q-safe-char { [<["]> <(] ~ [)> <["]>] <-["]>+ };
token safe-char { <-:C-[:;,"]>+ };
proto token parameter-name {*}
token parameter-name:sym<mediatype> { :i mediatype }
token parameter-name:sym<label> { :i label }
token parameter-name:sym<language> { :i language }
token parameter-name:sym<value> { :i value }
token parameter-name:sym<pref> { :i pref }
token parameter-name:sym<altid> { :i altid }
token parameter-name:sym<type> { :i type }
token parameter-name:sym<pid> { :i pid }
token parameter-name:sym<geo> { :i geo }
token parameter-name:sym<index> { :i index }
token parameter-name:sym<level> { :i level }
token parameter-name:sym<group> { :i group }
token parameter-name:sym<tz> { :i tz }
token parameter-name:sym<sort-as> { :i sort'-'as }
token parameter-name:sym<calscale> { :i calscale }
token parameter-name:sym<x-name> { <[xX]> '-' <.alpha-num-dash>+ }
#https://tools.ietf.org/html/rfc6350#page-73 - Vcard
#https://tools.ietf.org/html/rfc7095 - Jcard
#https://www.iana.org/assignments/vcard-elements/vcard-elements.xhtml#value-data-types - Iana
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- vCard::Parser
### -- Licenses: Artistic-2.0
### -- Authors: Petr Kolář
### -- File: lib/vCard/Parser/Actions.rakumod
### ----------------------------------------------------
unit class vCard::Parser::Actions;
my %default-type-of-value = %(
source => 'uri',
photo => 'uri',
member => 'uri',
tel => 'uri',
geo => 'uri',
url => 'uri',
key => 'uri',
caladruri => 'uri',
fburl => 'uri',
caluri => 'uri',
related => 'uri',
logo => 'uri',
sound => 'uri',
uid => 'uri',
clientpidmap => 'uri',
impp => 'uri',
org-directory => 'uri',
adr => 'text',
email => 'text',
org => 'text',
birthplace => 'text',
deathplace => 'text',
expertise => 'text',
hobby => 'text',
interest => 'text',
title => 'text',
role => 'text',
categories => 'text',
kind => 'text',
note => 'text',
prodid => 'text',
xml => 'text',
fn => 'text',
n => 'text',
nickname => 'text',
gender => 'text',
tz => 'text',
bday => 'date-and-or-time',
anniversary => 'date-and-or-time',
deathdate => 'date-and-or-time',
lang => 'language-tag',
rev => 'timestamp',
);
method made-value ($_) {
when $_.elems > 1 {$_».made}
default {$_[0].made}
}
method TOP ($/) { make $.made-value($<vcard>) }
method vcard ($/) {
make ["vcard",
[
["version", %(), "text", "4.0"],
|$<content-line>».made;
]
]
}
method content-line ($/) {
#preparing a hashArray of parameters
my %parameter = %($<parameter>».made);
my $parameter-of-type-value = %parameter<value>[0] // %default-type-of-value{$<property-name>.lc} // 'unknown';
%parameter<value>:delete;
#add a group to hashArray of parameters if-exists
with $<group> {
%parameter<group> = $_.Str
}
make [
$<property-name>.lc,
%parameter,
$parameter-of-type-value,
$.made-value($<property-value>)
]
}
method property-simple-value ($/) {
make $/.subst( / \\ )> <[,;]> /, Q{}, :g ).subst(/ \\n/, "\n", :g)
}
method property-value ($/) {
make $.made-value($<property-simple-value>)
}
method parameter ($/) {
make $<parameter-name>.lc => $.made-value($<parameter-value>);
}
method parameter-value ($/) {
with $<q-safe-char> {make $_.made}
orwith $<safe-char> {make $_.Str}
}
method q-safe-char ($/) {
make $/.subst(/ \\ )> <[,\;]> /, Q{}, :g ).subst(/ \\n /, "\n", :g)
}
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- vars
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: META6.json
### ----------------------------------------------------
{
"auth": "zef:lizmat",
"authors": [
"Elizabeth Mattijsen"
],
"build-depends": [
],
"depends": [
],
"description": "Raku port of Perl's 'vars' pragma",
"license": "Artistic-2.0",
"name": "vars",
"perl": "6.c",
"provides": {
"vars": "lib/vars.rakumod"
},
"resources": [
],
"source-url": "https://github.com/lizmat/vars.git",
"tags": [
"UTILS",
"CPAN5"
],
"test-depends": [
],
"version": "0.0.6"
}
|
### ----------------------------------------------------
### -- vars
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: LICENSE
### ----------------------------------------------------
The Artistic License 2.0
Copyright (c) 2000-2006, The Perl Foundation.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
This license establishes the terms under which a given free software
Package may be copied, modified, distributed, and/or redistributed.
The intent is that the Copyright Holder maintains some artistic
control over the development of that Package while still keeping the
Package available as open source and free software.
You are always permitted to make arrangements wholly outside of this
license directly with the Copyright Holder of a given Package. If the
terms of this license do not permit the full use that you propose to
make of the Package, you should contact the Copyright Holder and seek
a different licensing arrangement.
Definitions
"Copyright Holder" means the individual(s) or organization(s)
named in the copyright notice for the entire Package.
"Contributor" means any party that has contributed code or other
material to the Package, in accordance with the Copyright Holder's
procedures.
"You" and "your" means any person who would like to copy,
distribute, or modify the Package.
"Package" means the collection of files distributed by the
Copyright Holder, and derivatives of that collection and/or of
those files. A given Package may consist of either the Standard
Version, or a Modified Version.
"Distribute" means providing a copy of the Package or making it
accessible to anyone else, or in the case of a company or
organization, to others outside of your company or organization.
"Distributor Fee" means any fee that you charge for Distributing
this Package or providing support for this Package to another
party. It does not mean licensing fees.
"Standard Version" refers to the Package if it has not been
modified, or has been modified only in ways explicitly requested
by the Copyright Holder.
"Modified Version" means the Package, if it has been changed, and
such changes were not explicitly requested by the Copyright
Holder.
"Original License" means this Artistic License as Distributed with
the Standard Version of the Package, in its current version or as
it may be modified by The Perl Foundation in the future.
"Source" form means the source code, documentation source, and
configuration files for the Package.
"Compiled" form means the compiled bytecode, object code, binary,
or any other form resulting from mechanical transformation or
translation of the Source form.
Permission for Use and Modification Without Distribution
(1) You are permitted to use the Standard Version and create and use
Modified Versions for any purpose without restriction, provided that
you do not Distribute the Modified Version.
Permissions for Redistribution of the Standard Version
(2) You may Distribute verbatim copies of the Source form of the
Standard Version of this Package in any medium without restriction,
either gratis or for a Distributor Fee, provided that you duplicate
all of the original copyright notices and associated disclaimers. At
your discretion, such verbatim copies may or may not include a
Compiled form of the Package.
(3) You may apply any bug fixes, portability changes, and other
modifications made available from the Copyright Holder. The resulting
Package will still be considered the Standard Version, and as such
will be subject to the Original License.
Distribution of Modified Versions of the Package as Source
(4) You may Distribute your Modified Version as Source (either gratis
or for a Distributor Fee, and with or without a Compiled form of the
Modified Version) provided that you clearly document how it differs
from the Standard Version, including, but not limited to, documenting
any non-standard features, executables, or modules, and provided that
you do at least ONE of the following:
(a) make the Modified Version available to the Copyright Holder
of the Standard Version, under the Original License, so that the
Copyright Holder may include your modifications in the Standard
Version.
(b) ensure that installation of your Modified Version does not
prevent the user installing or running the Standard Version. In
addition, the Modified Version must bear a name that is different
from the name of the Standard Version.
(c) allow anyone who receives a copy of the Modified Version to
make the Source form of the Modified Version available to others
under
(i) the Original License or
(ii) a license that permits the licensee to freely copy,
modify and redistribute the Modified Version using the same
licensing terms that apply to the copy that the licensee
received, and requires that the Source form of the Modified
Version, and of any works derived from it, be made freely
available in that license fees are prohibited but Distributor
Fees are allowed.
Distribution of Compiled Forms of the Standard Version
or Modified Versions without the Source
(5) You may Distribute Compiled forms of the Standard Version without
the Source, provided that you include complete instructions on how to
get the Source of the Standard Version. Such instructions must be
valid at the time of your distribution. If these instructions, at any
time while you are carrying out such distribution, become invalid, you
must provide new instructions on demand or cease further distribution.
If you provide valid instructions or cease distribution within thirty
days after you become aware that the instructions are invalid, then
you do not forfeit any of your rights under this license.
(6) You may Distribute a Modified Version in Compiled form without
the Source, provided that you comply with Section 4 with respect to
the Source of the Modified Version.
Aggregating or Linking the Package
(7) You may aggregate the Package (either the Standard Version or
Modified Version) with other packages and Distribute the resulting
aggregation provided that you do not charge a licensing fee for the
Package. Distributor Fees are permitted, and licensing fees for other
components in the aggregation are permitted. The terms of this license
apply to the use and Distribution of the Standard or Modified Versions
as included in the aggregation.
(8) You are permitted to link Modified and Standard Versions with
other works, to embed the Package in a larger work of your own, or to
build stand-alone binary or bytecode versions of applications that
include the Package, and Distribute the result without restriction,
provided the result does not expose a direct interface to the Package.
Items That are Not Considered Part of a Modified Version
(9) Works (including, but not limited to, modules and scripts) that
merely extend or make use of the Package, do not, by themselves, cause
the Package to be a Modified Version. In addition, such works are not
considered parts of the Package itself, and are not subject to the
terms of this license.
General Provisions
(10) Any use, modification, and distribution of the Standard or
Modified Versions is governed by this Artistic License. By using,
modifying or distributing the Package, you accept this license. Do not
use, modify, or distribute the Package, if you do not accept this
license.
(11) If your Modified Version has been derived from a Modified
Version made by someone other than you, you are nevertheless required
to ensure that your Modified Version complies with the requirements of
this license.
(12) This license does not grant you the right to use any trademark,
service mark, tradename, or logo of the Copyright Holder.
(13) This license includes the non-exclusive, worldwide,
free-of-charge patent license to make, have made, use, offer to sell,
sell, import and otherwise transfer the Package with respect to any
patent claims licensable by the Copyright Holder that are necessarily
infringed by the Package. If you institute patent litigation
(including a cross-claim or counterclaim) against any party alleging
that the Package constitutes direct or contributory patent
infringement, then this Artistic License to you shall terminate on the
date that such litigation is filed.
(14) Disclaimer of Warranty:
THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL
LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
### ----------------------------------------------------
### -- vars
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: README.md
### ----------------------------------------------------
[](https://github.com/lizmat/vars/actions)
NAME
====
Raku port of Perl's 'vars' pragma
SYNOPSIS
========
use vars <$frob @mung %seen>;
DESCRIPTION
===========
This module tries to mimic the behaviour of Perl's `vars` pragma as closely as possible in the Raku Programming Language.
This will predeclare all the subroutine whose names are in the list, allowing you to use them without parentheses even before they're declared.
Unlike pragmas that affect the $^H hints variable, the "use vars" declarations are not BLOCK-scoped. They are thus effective for the entire package in which they appear. You may not rescind such declarations with "no vars".
See "Pragmatic Modules" in perlmodlib and "strict vars" in strict.
PORTING CAVEATS
===============
Due to the nature of the export mechanism in raku, it is impossible (at the moment of this writing: 2018.05) to export to the OUR:: stash from a module. Therefore the raku version of this module exports to the **lexical** scope in which the `use` command occurs. For most standard uses, this is equivalent to the Perl behaviour.
AUTHOR
======
Elizabeth Mattijsen <[email protected]>
Source can be located at: https://github.com/lizmat/vars . 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.
|
### ----------------------------------------------------
### -- vars
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: dist.ini
### ----------------------------------------------------
name = vars
[ReadmeFromPod]
; enable = false
filename = lib/vars.rakumod
[PruneFiles]
; match = ^ 'xt/'
[Badges]
provider = github-actions/test
[UploadToZef]
|
### ----------------------------------------------------
### -- vars
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: t/01-basic.t
### ----------------------------------------------------
use v6.*;
use Test;
BEGIN my @vars = <$frob @mung %seen>;
BEGIN plan 2 * @vars + 1;
use vars @vars;
BEGIN ok ::{$_}:exists, "did we get an export for $_ at BEGIN" for @vars;
ok $frob.VAR ~~ Scalar, 'is $frob a scalar container';
ok @mung ~~ Array, 'is @mung an Array';
ok %seen ~~ Hash, 'is %seen a Hash';
{
my $exception-seen;
EVAL 'use vars <zinkfnob>';
CATCH { default {
$exception-seen = True if $_.Str.contains('zinkfnob');
.resume
} }
ok $exception-seen, 'did we see an exception with zinkfnob';
}
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- vars
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: lib/vars.rakumod
### ----------------------------------------------------
use v6.*;
module vars:ver<0.0.6>:auth<zef:lizmat> { }
sub EXPORT(*@vars) {
my %export;
my @huh;
for @vars -> $name {
%export{$name} := $name.starts-with('$')
?? my $
!! $name.starts-with('@')
?? []
!! $name.starts-with('%')
?? %()
!! @huh.push($name)
}
die "Don't know how to export: @huh[]" if @huh;
%export
}
=begin pod
=head1 NAME
Raku port of Perl's 'vars' pragma
=head1 SYNOPSIS
use vars <$frob @mung %seen>;
=head1 DESCRIPTION
This module tries to mimic the behaviour of Perl's C<vars> pragma
as closely as possible in the Raku Programming Language.
This will predeclare all the subroutine whose names are in the list,
allowing you to use them without parentheses even before they're declared.
Unlike pragmas that affect the $^H hints variable, the "use vars" declarations
are not BLOCK-scoped. They are thus effective for the entire package in which
they appear. You may not rescind such declarations with "no vars".
See "Pragmatic Modules" in perlmodlib and "strict vars" in strict.
=head1 PORTING CAVEATS
Due to the nature of the export mechanism in raku, it is impossible (at the
moment of this writing: 2018.05) to export to the OUR:: stash from a module.
Therefore the raku version of this module exports to the B<lexical> scope
in which the C<use> command occurs. For most standard uses, this is equivalent
to the Perl behaviour.
=head1 AUTHOR
Elizabeth Mattijsen <[email protected]>
Source can be located at: https://github.com/lizmat/vars . Comments and
Pull Requests are welcome.
=head1 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.
=end pod
# vim: expandtab shiftwidth=4
|
### ----------------------------------------------------
### -- wordfinder
### -- Licenses:
### -- Authors:
### -- File: META6.json
### ----------------------------------------------------
{
"name": "wordfinder",
"auth": "zef:ian-nai",
"version": "0.0.1",
"api": 0,
"provides": {
"wordfinder": "lib/wordfinder.rakumod"
},
"depends": [],
"build-depends": [],
"test-depends": [],
"resources": [
"en_dict.txt"
],
"source-url": "https://github.com/ian-nai/raku_wordfinder/",
"tags": [ "word finder", "nlp", "text analysis"],
"description": "Find words containing specified letters. Users can specify length and provide their own dictionaries of words."
}
|
### ----------------------------------------------------
### -- wordfinder
### -- Licenses:
### -- Authors:
### -- File: LICENSE
### ----------------------------------------------------
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
### ----------------------------------------------------
### -- wordfinder
### -- Licenses:
### -- Authors:
### -- File: README.md
### ----------------------------------------------------
# Wordfinder
A word finding package that generates words containing specified letters. Comes prepackaged with an English dictionary, but can also be used with custom dicitonary files and arrays of words.
## Installation
Install using zef:
```
zef install wordfinder
```
Or simply download the GitHub repo.
## Usage
The package uses either a text file or a user-defined array to check for valid words, and comes prepackaged with a list of English words that can be easily called using the subroutines below.
The following three subroutines can be called; each takes a variable number of arguments and returns an array.
To check for words against a dictionary loaded from the provided file containing English words, use the check_file subroutine. To search for matching words, simply type the letters you'd like to check:
```
use wordfinder;
check_file("abse");
# this would return words such as "base" and "bases"
```
To specify a specific word length, provide two arguments: first your letters, then the desired length of the word.
```
check_file("abse", 4);
# this would return "base" but not "bases," as it is only looking for 4 letter words
```
To use a different text file containing a list of words, specify the filepath within the subroutine call to check_file like in the examples below. Your text file must have each word on a new line. Specify your file path following the words you'd like to match:
```
check_file("abse", "path/to/file.txt");
# this would return any matching words from the file you specify
```
Word length can be specified following the file path:
```
check_file("abse", "path/to/file.txt", 7);
# this would return any matching 7 letter words from the file you specify
```
Finally, the check_array subroutine will check for words in a specified array. You can optionally specify the word length you're looking for here, as well:
```
my @sample_array = ["base", "abase", "bases"]
check_array("abse", @sample_array);
# returns ["base", "abase", "bases"]
my @sample_array = ["base", "abase", "bases"]
check_array("abse", @sample_array, 4);
# returns ["base"]
```
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.