Perl 6 utilities to work with the (somewhat questionable) augment feature
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Augment::Util - utilities to work with the augment feature


use Augment::Util;

my @array = <aaa bbb ccc>;

augment class Any {
    method hiccup {
        say "hic!";

@array.hiccup; # hic!


This module makes the Augur class available, which provides methods useful for working with the perl6 "augment" feature:

  • recompose_core runs the ".^compose" method on everything defined in CORE.

  • inside_repl checks if runnning inside the repl

This covers for a known bug in the use of augment: you can use it to add methods to a class, and they should be automatically visible in all child classes, but often are not because the augment can't effect things that were created before you made the change... unless you run the ".^compose" method on them, to force a re-initialization.

Someday the need for recompose_core will probably go away once this bug has been addressed, but for now it's a useable workaround.

Another issue with augment is that it's use is strongly discouraged because it's the kind of thing that works fine once, but when it's being used a lot by many people there are potential conflicts. Don't do it unless you know what you're doing, and even then...


I'm after a way to make the Object::Examine method "menu" readily available in my repl sessions, without needing to manually add a role to anything I'd like to run it on.


The Mystery Line

There is a line in this code marked with the comment "The Mystery Line", which looks like it shouldn't do anything, but without it (or something like it) I've seen this code crash with errors like:

Cannot look up attributes in a VMNull type object

The Mystery Line does a gist call and does nothing with the response:

my $nada = $type_object.gist;

Presumbably what's going on is the code for ".gist" is better excercised than ".^compose", and does a better job of checking for problems and throwing a trappable error, .e.g. if the methods are being called on an NQP object.

See this discussion by Brandon Allerby:


Joseph Brenner,


Copyright (C) 2018 by Joseph Brenner

Released under "The Artistic License 2.0".