1
1
Fork
You've already forked hide-methods
0
hide methods of classes during runtime https://raku.land/zef:lizmat/hide-methods
  • Raku 100%
Elizabeth Mattijsen 1b8dfa70b1 0.0.8
2026年06月26日 09:10:40 +02:00
.github CI test prio to release 2026年06月26日 09:06:12 +02:00
.META 0.0.8 2026年06月26日 09:10:40 +02:00
doc CI test prio to release 2026年06月26日 09:06:12 +02:00
lib CI test prio to release 2026年06月26日 09:06:12 +02:00
t CI test for 0.0.7 release 2024年09月23日 14:47:43 +02:00
xt CI test prio to release 2026年06月26日 09:06:12 +02:00
.gitignore Move doc and add preliminary coverage tests 2025年01月15日 12:20:36 +01:00
Changes 0.0.8 2026年06月26日 09:10:40 +02:00
dist.ini Move doc and add preliminary coverage tests 2025年01月15日 12:20:36 +01:00
LICENSE Initial commit 2020年10月20日 18:55:38 +02:00
META6.json 0.0.8 2026年06月26日 09:10:40 +02:00
README.md CI test prio to release 2026年06月26日 09:06:12 +02:00
run-tests CI test prio to release 2026年06月26日 09:06:12 +02:00

Actions Status Actions Status Actions Status

NAME

hide-methods - hide methods of classes during runtime

SYNOPSIS

use hide-methods;
class A {
 method foo() { say "foo" }
}
A.foo; # foo
hide-methods(A,"foo");
A.foo; # X::Method::NotFound
class B {
 method bar() { say "bar" }
}
B.bar; # bar
my $vault = B.&hide-methods("bar");
B.bar; # X::Method::NotFound
$vault.unhide-methods("bar");
B.bar; # bar

DESCRIPTION

The hide-methods distribution exports a single subroutine called hide-methods. Calling this subroutine with a class and one or more method names, will hide the indicated methods from execution, resulting in either having a X::Method::NotFound exception thrown, or a method with the same name called from a parent class (if that doesn't happen to be hidden as well, of course).

Handles standard method call dispatch and the .can method on classes. Does not affect dispatch through .?, .+ or .*, or listing with the .^methods method.

SUBROUTINES

hide-methods

hide-methods(A,<foo bar baz>); # hide "foo","bar","baz" methods in A
A.&hide-methods(<foo bar baz>); # same, using method syntax
my $vault = hide-methods(B,"zippo"); # allow unhiding
$vault.unhide-methods("zippo"); # make B.zippo available again

The hide-methods subroutine takes a class as the first parameter, and one or more names of methods to hide. It returns a Vault object that supports a unhide-methods method, that takes the names of the methods that should become available again.

AUTHOR

Elizabeth Mattijsen liz@raku.rocks

Source can be located at: https://codeberg.org/lizmat/hide-methods . Comments and Pull Requests are welcome.

If you like this module, or what I'm doing more generally, committing to a small sponsorship would mean a great deal to me!

COPYRIGHT AND LICENSE

Copyright 2020, 2021, 2024, 2025, 2026 Elizabeth Mattijsen

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