Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
doc class WrapHandle
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| =TITLE class WrapHandle | ||
| =SUBTITLE Holds all information needed to unwrap a wrapped routine. | ||
| class WrapHandle { ... } | ||
|
|
||
| C<WrapHandle> is created and returned by L<wrap|/type/Routine#method_wrap>. It's only use is to unwrap wrapped routines. Either call L<unwrap|/type/Routine#method_unwrap> on a routine object or call the method C<restore> on a C<WrapHandle> object. | ||
|
|
||
| sub f(){ say 'f was called' } | ||
| my $wrap-handle = &f.wrap({ say 'before'; callsame; say 'after' }) | ||
|
|
||
| f; | ||
| $wrap-handle.restore; | ||
| f; | ||
| # OUTPUT«beforef was calledafterf was called» | ||
|
|
||
| =head1 Methods | ||
| =head2 method restore | ||
| method restore() returns Bool:D | ||
|
|
||
| Unwraps a wrapped routine and returns C<Bool::True> on success. |