Le 11/06/2011 18:22, Les Mikesell a écrit :
On 6/11/11 11:08 AM, Alain Péan wrote:
So this was my first-ever vim script. So far I am not convinced about vim scripting (ok, I was warned, too)... Test cycle is slow (modify script, quit the realfile, open realfile again with vim -s script). Verbal error messages would be useful. There is supposed to be "integrated debugger". I would like to know more.
I'd still recommend learning to do it in perl as being likely faster and more generally useful, especially if the sql db you mentioned can be accessed directly. The regeps will be approximately the same and it is easy to find perl example code for DBI operations and manipulating files. And unlike working in shell/awk/editors, you very seldom find an operation that perl can't do itself so it often ends up simpler than the shell wrapper you need for other tools.
I hope not to begin a flame war, but I would recommend Python. It can do the same things as Perl (regexp ansd so on), but is easier and faster to learn, and the code is also much more readeable...
There is sort-of a tradeoff in the syntax choices between the languages. Perl is easier to write because it is flexible and you can use a syntax that resembles something you already know (shell/c/awk) with simple changes. That makes other peoples perl less readable, but not your own. The other win for perl is that any operation that would take more than a page of code that you are likely to want to do has almost certainly already been done and is available as a module on CPAN (and possibly packaged as an rpm). Does python have anything to match that yet? How many database types can it access with available modules? Perl's DBI/DBD connector list is pretty large.
Here it is. It seems to me rather large, even if I don't know the equivalent list for Perl : http://wiki.python.org/moin/DatabaseInterfaces
There are also a very large number of Python modules available, and tools to easily install them, for example there : http://pypi.python.org/pypi
Alain