There are a few things you might consider here. One is putting lexicals at a scope where they would be visible to all subs. If you're using Apache::Registry, this will be a problem. This is one reason I don't use Apache::Registry.
You could make them globals. Sometimes that's the most expedient solution. You just need to make sure you re-initialize them on each request.
If they're static constants, you could put them off in some constants package. You still need to make them globals.
However, when people have issues like this it often means they should be using objects. Objects are the standard way of encapsulating a set of data and giving it behaviors, and it sounds like that might be what you're doing.
Finally, you could stick them $r->pnotes(). It's globally accessible through the request object, and it's automatically cleaned up after each request. You can perldoc Apache for the details. |