txt: ## wrap.md
  wrap
  
  Combined from primary sources listed below.
  
  # [In Routine](#___top "go to top of document")[§](#(Routine)_method_wrap "direct link")
  
  See primary documentation
  [in context](/type/Routine#method_wrap)
  for **method wrap**.
  
  ```raku
  method wrap(Routine:D: &wrapper)
  ```
  
  Wraps (i.e. in-place modifies) the routine. That means a call to this routine first calls `&wrapper`, which then can (but doesn't have to) call the original routine with the `callsame`, `callwith`, `nextsame` and `nextwith` dispatchers. The return value from the routine is also the return value from the wrapper.
  
  `wrap` returns an instance of a private class called [`Routine::WrapHandle`](/type/Routine/WrapHandle), which you can pass to [unwrap](/routine/unwrap) to restore the original routine.
  