Syntax check in Perl and Python
I work a lot with python and perl scripts. One time I searched a solution to
check syntax of written scripts automatical. First of all to check it on console
after creating a new one or updating an old one. Second possibility I’m thinking
about is to configure it in Jenkins and use it at
automatic build calls.
At both languages exists the option -c
.
Python
At Python you can call
python -c "__import__('compiler').parse(open(’/path/to/python-script.py’).read())"
in console.
Perl
At Perl it is a little bit smaller:
perl -c /path/to/perl-script.pl