I'm wondering if there is a standard workaround that's fairly transparent to the end user? I'd rather not force them to explicitly call a setup method.
I have tried to do this same thing with Class::Trait and never managed to get it to work. And recently dragonchild and I did the same thing with Class::LazyLoad. I also think liz had a similiar issue with one of her thread modules as well. The general solution seems to be to force the use to explictly call the set up under mod_perl. To be honest, this is ugly, but has never been a big problem since it can just go in the startup.pl which I load at server startup anyway.
Since the code uses a filter, I suppose I could explicitly set up the setup call for them, but that seems rather ugly.
I don't think that seems ugly at all. It is doing what the user would expect it to do, which is what it would do under non-mod_perl circumstances. As far as I am concerned that is an elegant solution since it prevents the user from having to deal with your internals or be concerned about silly internal issues under mod_perl. It might look ugly in the code, but I don't think the perl parser will be offended :)