I know nothing about mod_perl. Nothing at all! But...
Because unless calling DBI->Connect(...) is extremely fast, using a macro to substitute that call for DB_connect() is going to make very little difference.
Why not call it once at the start of each function and assign it to a local variable?
I realise that this increases your exposure to the lose of your DB connection (slightly?) but given your use of RaiseError, you are already handling the possibility of errors on individual calls to DBI, this would be just one more potential error.
Is the probability of the connection dropping within any given function (as opposed to between them) really so high?
Beyond that, if you really need a macro facility, there are several possibilities:
This probably wouldn't work with mod_perl?
Note: I'm not recommending you use any of these--indeed, from what information you've posted it is hard to see how a macro facility would benefit you in any significant way--but it is good to have the information available even if only that you can make your own mind up with good conscience.
In reply to Re: best way to inline code? (i.e. macro)
by BrowserUk
in thread best way to inline code? (i.e. macro)
by ManFromNeptune
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |