class WrapHandle

Holds all information needed to unwrap a wrapped routine.

class WrapHandle { ... }

WrapHandle is created and returned by wrap. It's only use is to unwrap wrapped routines. Either call unwrap on a routine object or call the method restore on a WrapHandle object.

sub f() { say 'f was called' }
my $wrap-handle = &f.wrap({ say 'before'callsamesay 'after' });
 
f;
$wrap-handle.restore;
f;
# OUTPUT: «before␤f was called␤after␤f was called␤» 

Methods

method restore

method restore(--> Bool:D)

Unwraps a wrapped routine and returns Bool::True on success.