In Phasers§

See primary documentation in context for CONTROL

Runs when a control exception is raised by the current block, before the LEAVE phase. It is raised by return, fail, redo, next, last, done, emit, take, warn, proceed and succeed.

say elems gather {
    CONTROL {
        when CX::Warn { say "WARNING!!! $_".resume }
        when CX::Take { say "Don't take my stuff".resume }
        when CX::Done { say "Done".resume }
    }
    warn 'people take stuff here';
    take 'keys';
    done;
}
# OUTPUT: 
# WARNING!!! people take stuff here 
# Don't take my stuff 
# Done 
# 0