|Just another Perl shrine|
Re^4: goto &sub and local questionby rovf (Priest)
|on Nov 25, 2008 at 09:50 UTC||Need Help??|
Why? What about your usage requires you to call a subroutine with goto?
Well, I wanted to spare you these tedious details, because I didn't consider them important to know, but here we go:
The module these functions are in is a mediation layer to a logging module (Log::Log4perl actually). Originally, the client modules used, for instance, Log4perl functions such as DEBUG(...) or ERROR(...) to generate the logs.
This system is now about to be modified in that DEBUG, ERROR etc. should first invoke some of our own code to do some preliminary work, and then pass on the DEBUG, ERROR etc. of the Log4perl module. In addition, my own version of these routines to do first some special processing, then some general processing (which is common to all type of traces), and then pass control to Log4perl. Basically, the information flow is as follows:
the Log4perl logging routines would report MyLogging::general as caller, instead of the original call site of DEBUG().
Maybe there is a callback mechanism in Log4perl which I could use; the documentation of Log4perl is pretty big and I thought that my problem is so easy that I could do it simply by using (kind of):
Actually, it *does* work that way, and I believe that since these functions are small and co-operate closely, it is also easy to understand. Still, I am not absolutely happy with the solution either. If I find time, I should maybe take a few hours to wade through the Log4perl docs to get ideas for other solutions.
Ronald Fischer <email@example.com>