i've been going crazy trying to abstract my shared libraries into
something where the debug code is manageable and reusable without
hacking at the library. my problem was that I made too much use of
how perl optimizes away debug code if you use constants

i had tons of

DEBUG && print STDERR 'info'

i tried doing some stuff like i saw in other packages like this

our $Debug=0;

and then flipping it in the code that uses it.

that doesn't allow for perl to optimize stuff away.

entering captain obvious mode, i realized


i've now seen a 70% reduction in memory on my workhorse libraries
(forms, databse, etc ), which is huge.

going from 800k compiled to 140k is a giant memory saver.

its not as extensible as some of the other debug options, where you
get to change stuff on live code.

but i realized that for mod_perl stuff- restarting on a shared
environment with a new env is a hassle worth the performance tradeoff.

just a tip to anyone else out there who didn't realize this.