I have a perl program that does a text mining, that works a command line tool. As a web service user should provide the query and the email adress. A web service is of course different than a "normal" script, because you can have many users, etc.
I have no experiences in writing CGI scripts calling external programs, and possible problems arising by calling an external program when you have multiply users. and possible other problems that I do not see now.