fix indentation (remove tabs, 3 space and 2 space indentation)
use until instead of while(1){last if...}
follow perl recommendations:

* always 'use warnings'
* 'use parent' instead of base
* declare package variables with our, do not use vars
* do not load unused Carp package