简体   繁体   English

将Perl脚本包装到Web服务中

[英]Wrapping up a Perl script into a webservice

I have a Perl script that can be run from the command line and takes a file as an argument. 我有一个Perl脚本,可以从命令行运行,并将文件作为参数。 I want to be able to call this script from my JavaScript (in a Firefox addon). 我希望能够从我的JavaScript(在Firefox插件中)调用此脚本。 I was planning on using XMLHttpRequest . 我打算使用XMLHttpRequest But what is the best way to wrap up my Perl script into a webservice? 但是,将我的Perl脚本包装到Web服务中的最佳方法是什么? (Is there any Perl to SOAP convertor?) (是否有从Perl到SOAP的转换器?)

But what is the best way to wrap up my Perl script into a webservice? 但是,将我的Perl脚本包装到Web服务中的最佳方法是什么?

  1. Split the existing functionality of the code into a module that does the work and a small wrapper script to add a command line interface 将代码的现有功能拆分为可以工作的模块和一个小的包装脚本,以添加命令行界面
  2. Write another wrapper that presents a web interface. 编写另一个提供Web界面的包装。 (Probably using something like CGI::Application (which now supports other interfaces, so you aren't restricted to CGI) or Web::Simple ). (可能使用类似CGI :: Application的东西(现在支持其他接口,因此您不仅限于CGI)或Web :: Simple )。

(Is there any Perl to SOAP convertor?) (是否有从Perl到SOAP的转换器?)

Don't use SOAP. 不要使用SOAP。

SOAP is chunky, complex, and covers many many edge cases that are unlikely to be problems for you. SOAP块状,复杂,并且涵盖了许多对您来说不太可能成为问题的极端情况。 Use a light weight RESTful API instead. 请使用轻量级的RESTful API。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM