📄 使用perl创建voicexml应用程序 - fanqiang_com.htm
字号:
<TBODY>
<TR>
<TD class=a14>The mystic oracle can only answer
questions about romance, career,</TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14>or family matters. Please try
again.</TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14><REPROMPT /><SPAN lang=EN-US><SPAN
style="mso-spacerun: yes">
</SPAN><reprompt/></SPAN></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14></NOMATCH><SPAN lang=EN-US><SPAN
style="mso-spacerun: yes">
</SPAN></nomatch></SPAN></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14><NOINPUT count="1"><SPAN lang=EN-US><SPAN
style="mso-spacerun: yes">
</SPAN><noinput
count="1"></SPAN></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14>I can sense your
apprehension.</TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14><REPROMPT /><SPAN lang=EN-US><SPAN
style="mso-spacerun: yes">
</SPAN><reprompt/></SPAN></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14></NOINPUT><SPAN lang=EN-US><SPAN
style="mso-spacerun: yes">
</SPAN></noinput></SPAN></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14><NOINPUT count="2"><SPAN lang=EN-US><SPAN
style="mso-spacerun: yes">
</SPAN><noinput
count="2"></SPAN></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14>You must say
something.</TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14><REPROMPT /><SPAN lang=EN-US><SPAN
style="mso-spacerun: yes">
</SPAN><reprompt/></SPAN></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14></NOINPUT><SPAN lang=EN-US><SPAN
style="mso-spacerun: yes">
</SPAN></noinput></SPAN></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14><NOINPUT count="3"><SPAN lang=EN-US><SPAN
style="mso-spacerun: yes">
</SPAN><noinput
count="3"></SPAN></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14>Please call back when you are less
stressed.</TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14><DISCONNECT /><SPAN lang=EN-US><SPAN
style="mso-spacerun: yes">
</SPAN><disconnect/></SPAN></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14></NOINPUT><SPAN lang=EN-US><SPAN
style="mso-spacerun: yes">
</SPAN></noinput></SPAN></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD
class=a14>下面的内容是为了结束query_type字段、其父表格和最顶部的vxml元素。</TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14></FIELD><SPAN lang=EN-US><SPAN
style="mso-spacerun: yes">
</SPAN></field></SPAN></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14></FORM><SPAN lang=EN-US><SPAN
style="mso-spacerun: yes">
</SPAN></form></SPAN></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14></VXML><SPAN
lang=EN-US></vxml></SPAN></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD
class=a14>下面我们来创建响应用户问题的CGI脚本程序。这一脚本程序将接收一个通过POST方法传送、名字为query_type的字段的参数,query_type的可能的值为romance、career或
family。</TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14>use strict;</TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14>use CGI qw(:standard);</TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14>my $q = CGI->new();</TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14>my $query_type =
$q->param('query_type');</TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD
class=a14>首先,我们将生成一个针对用户所提问题的比较含糊的答案。</TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14>my @intro_phrases = ('My sources
say',</TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14>'All signs indicate
that',</TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14>'Search your heart. You
know');</TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14>my @responses = ('the answer is
yes.',</TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14>'the answer is no.',</TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14>'it is too soon to
tell.',</TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14>'the outlook is hazy. Please ask again
later.');</TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14>my $response_text = $intro_phrases[int(
rand ( scalar (@intro_phrases) ) )]
.</TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14>' ' .</TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14>$responses[int( rand ( scalar (@responses)
) )];</TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14>Then we will create the VoiceXML output.
Note how the inline Perl variables are used both to
include the randomly-generated answer to the caller's
question ($response_text) and to create an illusory
sense of personalized context by repeating the general
type of question that the caller asked
($query_type).</TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD
class=a14>下面我们将创建VoiceXML的输出。请注意内置的Perl变量━━$response_text和$query_type的使用。</TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14>print qq*</TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14><?xml version="1.0"?></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14><VXML><SPAN
lang=EN-US><vxml></SPAN></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=a14><SPAN lang=EN-US><form
id="response"></SPAN><BLOCK></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -