Perl: the Markov chain saw | |
PerlMonks |
Overloading '{}' or 'sub'by pkirsch (Novice) |
on Jan 01, 2009 at 19:14 UTC ( [id://733658]=perlquestion: print w/replies, xml ) | Need Help?? |
pkirsch has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks, I'm searching for a solution for overloading the closing bracket '}' operator or the 'sub'-statement. The idea behind this is, that I want to execute code in the scope of the brackets (some kind of a hook). This code needs to be the last operation of the context which the brackets are including. Furthermore every 'sub' (in a package) should be hooked with this post-execution-operation. Sadly I cannot rely on the return statement, otherwise I would like to overload this statement. I searched the perlmonks.org for 'overload builtin' but it gives me only hints for overloading arithmetical statements. The perl manpage for overload does not mention overloading 'sub' or '{}'.(In the case that: this way it is not possible, then what about the symbol table?). I tried e.g. following:
Regards,
Back to
Seekers of Perl Wisdom
|
|