Fix from corrected by syohex

some fix from corrected. For details, see http://d.hatena.ne.jp/syohex/20130120/1358647901.
- fix defgroup definition
- add checking valid perl path
- some refactoring
- remove useless functions
- add buffer local variables, for avoiding warnings