http://www.perlmonks.org?node_id=1072584


in reply to Re^2: Execute function before exit of do() block
in thread Execute function before exit of do() block

Well, in Perl 6 there are are non-object options, like a LEAVE block that is called on every scope exit, or an UNDO block for unsuccessful scope exists.

I wonder if those are possible (and worthy) to backport to perl 5...

Replies are listed 'Best First'.
Re^4: Execute function before exit of do() block
by ikegami (Patriarch) on Jan 30, 2014 at 00:28 UTC
Re^4: Execute function before exit of do() block
by shmem (Chancellor) on Jan 29, 2014 at 21:11 UTC

    Maybe that could be done in a cheap way overriding eval. Brrr... just as I am writing this, overriding eval feels very evil... ;-)

    perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'