[英]Pass variables from HTML form to Perl script
我在為內部使用Perl腳本生成配置的Perl腳本創建HTML前端時遇到了一些困難。 我們已經從Linux系統遷移到Windows服務器實例,並且我測試了CGI / Perl是否按預期工作。 腳本本身使用以下格式:
my $unitname; #name of device
my $clientid; #name of client
my $version; #version of device firmware
這些變量是通過命令行調用的,該命令行將配置輸出到cli:
./confgen.pl -u "unitname" -c "clientid" -v "version"
我想要達到的目的是使用HTML表單中的現有變量,但沒有任何運氣。 到目前為止,我有這個:
<form action confgen.pl method "get">
<input type="text" name="unitname">
<input type="text" name="clientid">
<input type="text" name="version">
<input type="submit" Value="generate"
</form>
有什么建議或例子嗎? 我應該補充一點,CGI和Perl並不是我的母語,但是我一直在努力。
您的HTML應該是這樣的
<form action="confgen.pl" method="get">
<input type="text" name="unitname">
<input type="text" name="clientid">
<input type="text" name="version">
<input type="submit" value="generate">
</form>
您是否正在使用任何Perl庫來接收HTTP請求? 考慮使用CGI http://perldoc.perl.org/CGI.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.