in reply to Limiting log file size

You might want to look at Logfile::Rotate.

It doesn't seem to support your 1M cap idea, but if you add some checking for the size exceeding your limits, its "rotate" method will handle moving off the old log file, and optionally compressing it for you.
--
Mike