简体   繁体   English

如何从另一个Perl CGI脚本调用Perl CGI脚本

[英]How to call a perl cgi script from another perl cgi script

I have a html form ... While submitting that form, I am calling one Perl CGI Script, that will save the data in MYSQL database. 我有一个html表单...在提交该表单时,我正在调用一个Perl CGI脚本,该脚本会将数据保存在MYSQL数据库中。

After saving the data in databse, i want to reopen the same page with all empty fields in form, means i want too reload the same form again. 将数据保存在databse中之后,我想重新打开同一页面,其中包含表单中的所有空白字段,这意味着我也想再次重新加载同一表单。

How can i achieve this? 我怎样才能做到这一点? or what should i call in my script so that i can come back to same form again. 或者我应该在脚本中调用什么,以便我可以再次返回相同的表格。

Remember i am generating the forms using template and perl script.. 记住我正在使用模板和perl脚本生成表单。

Thanks in advance 提前致谢

Is this second program really a CGI program? 这第二个程序真的是CGI程序吗? I mean does it accept parameters from a HTTP request and return it's results in an HTTP response? 我的意思是,它接受HTTP请求中的参数并在HTTP响应中返回结果吗?

If that's the case then you can call it using libraries from the LWP CPAN distribution. 如果是这种情况,则可以使用LWP CPAN发行版中的库进行调用。

If your second program is actually just a command program then you can call it using system . 如果第二个程序实际上只是命令程序,则可以使用system调用它。

You can redirect using HTML's meta refresh or by using JavaScript's window.location object. 您可以使用HTML的meta refresh或使用JavaScript的window.location对象进行重定向。 Have the CGI script output any of those. 让CGI脚本输出其中的任何一个。

Another way is to have the CGI script output a redirect header. 另一种方法是让CGI脚本输出重定向标头。 You can use CGI 's redirect method for this, or output it manually. 您可以为此使用CGIredirect方法,或手动输出它。

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

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