Hello,

quoting Apocalypse 6:
> You may ask a subroutine to wrap itself up in another subroutine in
> place, so that calls to the original are intercepted and interpreted by
> the wrapper, even if access is only through the reference:
> 
>     $id = $subref.wrap({
>         # preprocessing here
>         call;
>         # postprocessing here
>     }
[...]
> The $id is useful for removing a particular wrapper:
> 
>    $subref.unwrap($id);

One should be able to unwrap $subref using
     $id.unwrap();

Or, given $id, it'd be cool if you could get the original $subref:
     my $origsubref = $id.sub();

Additionally, $id could coerce to an ID number in numeric context, so
     $subref.unwrap($id);
would still be valid code (==> TIMTOWTDI).

What are your opinions on this? BTW, Perl5/Tk has the same problem IMHO:
     my $canvas = $widget->Canvas;
     my $id = $canvas->createLine(...);
     ...;
     $canvas->raise($id);
     # Better:
     $id->raise;


Sorry if this was discussed before, didn't found anything.


Ingo Blechschmidt

Reply via email to