Problems? Is your data what you think it is? | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Alex, short for Alexander, is a project I'm working on which involves a lot of batch processing jobs. The Boss wanted the logging information to go to the MySQL database instead of plain files, so I could make a pretty web interface for him to monitor the progress of various backend processes. (Yeah, I could have made a pretty web interface for flat files also, but such is The Boss.) Many log systems have different levels to indicate the severity of a message (or whether to even log it at all.) This system started out that way, but soon the "levels" really changed into "categories" which were not necessarily good or bad, so The Boss could run SQL queries against the log table to get information about a particular category of messages. I decided to experiment with closures and auto-generation of methods, and put all the categories into the database, so The Boss could add new ones himself. Upon instantiation, my log object would build a method for each category it found in the database. It works perfectly, but I'd like to hear any comments as this is the first time I've deployed something with dynamic methods on a large scale.
I'm sure there are also some CPAN modules that do this kind of thing, but I was in the mood for experimentation and it only took a few minutes to write. (And it worked right the first time, always a nice feeling.)
Thanks for looking. In reply to RFC: Alex::Log by friedo
|
|