我是perl的新手,我有一个按钮,当用户按下该按钮时,配置文件中的值将被设置为默认值。 这是我的配置文件config.conf:
[status]
status.state=1
status.state2=0
status.state3=1
我希望将上面的配置设置为默认值意味着1或0的值将作为默认值。当用户更改值时,例如:
[status]
status.state=1
status.state2=1
status.state3=0
用户按下默认按钮,配置文件中的值将与第一个中显示的值相同。我怎样才能做到这一点?我需要使用什么功能?
这是我的界面代码:
#!/usr/bin/perl
#index.cgi
require 'foobar-lib.pl';
ui_print_header(undef, $module_info{'desc'}, "", undef, 1, 1);
ui_print_footer("/", $text{'index'});
print "Content-type:text/html\n\n";
print qq~<html>
<link rel="stylesheet" type="text/css" href="style.css">
<body>
<div id="content">
<div id="bar">
<span><p>Voice</p></span>
</div>
<div id="main-container">
<table width="100%" height="100%">
<tr>
<td width="30%" align="left">
<div id="title"><span>BYPASS :</span></div>
</td>
<td width="35%">
<div id="form">
<form method="POST" action="index2.cgi">
<select name="vdgpb" size="1">
<option value="bypass_a">VOC_BYPASS_A</option>
<option value="bypass_b">VOC_BYPASS_B</option>
<option value="bypass_c">VOC_BYPASS_C</option>
<option value="bypass_d">VOC_BYPASS_D</option>
</select>
</td>
<td align="left">
<input type="radio" name="pb" value="1">High (1)
</br>
<input type="radio" name="pb" value="0">Low (0)
</div>
</td>
</tr>
<tr>
<td colspan="3">
<div id="description"><b>Description :</b></div>
</td>
</tr>
<tr>
<td colspan="3">
<div id="button">
<input type="submit" value="Submit"><input type="reset" value="Clear">
</form>
</div>
</td>
</tr>
<tr>
<td wiidth="30%" align="left">
<div id="title"><span>SELECTION A :</span></div>
</td>
<div id="form">
<form method="POST" action="index3.cgi">
<td width="35%">
<select name="vdgph" size="1">
<option value="sel_a">SEL A</option>
<option value="sel_b">SEL B</option>
<option value="sel_c">SEL C</option>
<option value="sel_d">SEL D</option>
</select>
</td>
<td align="left">
<input type="radio" name="ph" value="1">High (1)
</br>
<input type="radio" name="ph" value="0">Low (0)
</div>
</td>
</tr>
<tr>
<td colspan="3">
<div id="description"><b>Description :</b></div>
</td>
</tr>
<tr>
<td colspan="3">
<div id="button">
<input type="submit" value="Submit"><input type="reset" value="Clear">
</form>
</div>
</td>
</tr>
<tr>
<td width="30%" align="left">
<div id="title"><span>IMPEDENCE</span></p>
<p><span>SELECTION :</span></p>
</div>
</td>
<div id="form">
<form method="POST" action="index4.cgi">
<td width="35%">
<select name="vdgpk" size="1">
<option value="z1_a">Z1_A</option>
<option value="z1_b">Z1_B</option>
<option value="z1_c">Z1_C</option>
<option value="z1_d">Z1_D</option>
<option value="z2_a">Z2_A</option>
<option value="z2_b">Z2_B</option>
<option value="z2_c">Z2_C</option>
<option value="z2_d">Z2_D</option>
</select>
</td>
<td align="left">
<input type="radio" name="pk" value="1">High (1)
</br>
<input type="radio" name="pk" value="0">Low (0)
</div>
</td>
<tr>
<td colspan="3">
<div id="description"><b>Description :</b></div>
</td>
</tr>
<tr>
<td colspan="3">
<div id="button">
<input type="submit" value="Submit"><input type="reset" value="Clear">
</form>
</div>
</td>
</tr>
<tr>
<td colspan="3">
<div id="button">
<form action="index5.cgi"
<input type="submit" value="Default Settings">
</form>
</div>
</td>
</tr>
</table>
</div>
</div>
</body>
</html>
~;