Adding phasers to Block variables

Viewed 68

On the trail of this question by Codesections, I'm trying to add a phaser to a variable using traits. Something like this:

my &doing-good is Block will enter {
    .add_phaser: "ENTER",
            {
                    if Backtrace.new.grep: { .subname  ~~ /bad/ } {
                            fail("Not authorized to call this");
                    }
            }
};

This fails with is trait on &-sigil variable not yet implemented. Sorry.

I arrived to this because there seems no way to declare that as a block; by default is a Callable, and add_method does not work on Callables, apparently. Any other way of doing this?

0 Answers
Related