A simple idea: a single pragma to switch between development and production code behaviour.
use dev; # turns on strict, warnings, diagnostics
use dev 'LOGLEVEL' => 1; # turns on logging preset
use dev 'WARNFATAL' => 1; # warnings cause death
use dev 'ONFATAL' => sub { ... }; # callbacks
no dev; # for stable production code
Using [cpan://dev] would make it simpler to turn on and off things you might want in development code, but not in production code. Also, it might encourage standardization on certain logging tools and exception handling mechanisms.
To be honest, I'm not facing a bunch of situations where I particularly want to avoid strict, warnings, etc. Or, rather, I want them to be worked out before production because if they happen in production and they're masked, I may never know that my data got silently munged.
As for the logging, warn-fatal, etc., I probably want most of those either in a logfile or in my commandlines (or both).
I standardised our logging tools and exception handling mechanisms by centralising them in a Log module. Admittedly, it isn't a great mechanism, but it does suffice for our purpose. And it's the same code for all our scripts. I also standardised a lot of other things by putting them in modules. Such as commandline handling.
I'm not saying your idea isn't good. I'm saying that if it is, I'm currently missing it.
It's an interesting idea but I would want it to key off ENV vars. That way as I move code from a dev to a test to a production environment, no changes need to be made to the code.
A simple idea: a single pragma to switch between development and production code behaviour.
You seem to be saying that switching off logging, strict and warnings in production code would be a good idea?
I find that a curious suggestion - since I'd want them there more than anywhere else.
perlmonks.org content © perlmonks.org and adrianh, derby, rvosa, Tanktalus
prlmnks.org © 2006 edmund von der burg (eccles & toad)
v 0.03