📄 ch23.htm
字号:
script by the operating system.<LI>What will the statement <TT>$SIG{'ABRT'}= 'IGNORE'</TT> do?<BR>You can cause Perl to ignore the Ctrl+c key sequeNCe by placingthis line of code near the beginning of your program.<LI>Which signal is used to trap floating point exceptions?<BR><B>FPE-</B></OL><H2><A NAME="Chapter"><FONT SIZE=5 COLOR=#FF0000>Chapter 14</FONT></A></H2><OL><LI>What is an object?<BR><B>Actually, "What are objects?" is a silly questionbecause you already know what an object is. Trust your instiNCts.The book you are reading is an object. The knife and fork thatyou eat with are objects. In short, your life is filled with them.</B><LI>What is a class?<BR><B>The question that really needs to be asked is, "What areclasses?" You see, all object oriented techniques use classesto do the real work. A <I>class</I> is a combination of variablesand fuNCtions designed to emulate an object. However, when referringto variables in a class, object-oriented folks use the term <I>properties</I>.And when referring to fuNCtions in a class, the term <I>method</I>is used.</B><LI>What is a property?<BR><B>Variables in a class.</B><LI>What does the term polymorphism mean?<BR><B>A child class can redefine a method already defined in theparent class.</B><LI>Is the <TT>bless()</TT> fuNCtionused to create classes?<BR><B>No. The </B><TT><B><FONT FACE="Courier">bless()</FONT></B></TT><B>fuNCtion is used to change the data type of the anonymous hashto </B><TT><B><FONT FACE="Courier">$class</FONT></B></TT><B> or</B><TT><B><FONT FACE="Courier">Inventory_item</FONT></B></TT><B>.</B><LI>What does the <TT>package</TT>keyword do?<BR><B>The </B><TT><B><FONT FACE="Courier">package</FONT></B></TT><B>keyword is used to introduce new classes and namespaces.</B><LI>What can a static variable be used for?<BR><B>Static variables can be used to emulate <I>constants</I>-valuesthat don't change.</B><LI>Why is it good to use anonymous hashes to represent objectsinstead of regular arrays?<BR><B>Child classes, in Perl, will not automatically inherit propertiesfrom its parents. However, using anonymous hashes totally avoidsthis issue because the parent constructor can be explicitly calledto create the object. Then, the child can simply add entries tothe anonymous hash.</B><LI>How can you create a fuNCtion that is available to all classesin your script?<BR><B>Start a definition of the </B><TT><B><FONT FACE="Courier">UNIVERSAL</FONT></B></TT><B>class.</B></OL><H2><A NAME="Chapter"><FONT SIZE=5 COLOR=#FF0000>Chapter 15</FONT></A></H2><OL><LI>What is a module?<BR><B>A <I>module</I> is a namespace defined in a file. For example,the </B><TT><B><FONT FACE="Courier">English</FONT></B></TT><B>module is defined in the </B><TT><B><FONT FACE="Courier">English.pm</FONT></B></TT><B>file and the </B><TT><B><FONT FACE="Courier">Find</FONT></B></TT><B>module is defined in the </B><TT><B><FONT FACE="Courier">Find.pm</FONT></B></TT><B>file.</B><LI>What is the correct file extension for a module?<BR><B>.pm</B><LI>What is a pragma?<BR><B>It turns other compiler directives on and off.</B><LI>What is the most important pragma and why?<BR><B>The most important pragma is </B><TT><B><FONT FACE="Courier">strict</FONT></B></TT><B>.This pragma generates compiler errors if unsafe programming isdetected.</B><LI>What does the <TT>END</TT> blockdo?<BR><TT><B><FONT FACE="Courier">END</FONT></B></TT><B> blocks writea message to a log file about end times for the program.</B><LI>What is a symbol table and how are they named?<BR><B>A <I>symbol table</I>, in Perl, is a hash that holds all ofthe names defined in a namespace. All of the variable and fuNCtionnames can be found there. The hash for each namespace is namedafter the namespace with two colons.</B><LI>How can you create a variable that is local to a package?<BR><B>Fully qualify your variable name in the declaration or initializationstatement.</B></OL><H2><A NAME="Chapter"><FONT SIZE=5 COLOR=#FF0000>Chapter 16</FONT></A></H2><OL><LI>What is a logic error?<BR><I><B>Logic</B></I><B> errors are insidious and difficult to find.For example, you might place an assignment statement inside an</B><TT><B><FONT FACE="Courier">if</FONT></B></TT><B> statementblock that belongs outside the block. Or you might have a loopthat runs from 0 to 100 when it should run from 10 to 100. Accidentallydeleting the 1 or not entering it in the first place is very easy.</B><LI>What is a compile-time error?<BR><B>Compile-time errors are also known as syntax errors and aremade as you type your script into an editor.</B><LI>What will the <TT>D</TT> debuggercommand do?<BR><B>Deletes all breakpoints.</B><LI>What is a conditional breakpoint?<BR><B>A</B> <B>breakpoint that occurs only when certain criteriaare met.</B><LI>What will the <TT>c</TT> debuggercommand do?<BR><B>Executes the rest of the statements in your script unless abreakpoint is found before the script ends. You can optionallyuse this command to create a temporary break by specifying a linenumber after the </B><TT><B><FONT FACE="Courier">c</FONT></B></TT><B>.</B><LI>Can you invoke any fuNCtion directly from the debugger commandline?<BR><B>Yes.</B><LI>What is an alias?<BR><B>An alias is a way of assigning a name to a long command usedover and over again.</B><LI>What is a common error associated with conditional expressions?<BR><B>One of the most common logic problems is using the assignmentoperator (</B><TT><B><FONT FACE="Courier">=</FONT></B></TT><B>)when you should use the equality operator (</B><TT><B><FONT FACE="Courier">==</FONT></B></TT><B>).If you are creating a conditional expression, you'll almost alwaysuse the equality operator (</B><TT><B><FONT FACE="Courier">==</FONT></B></TT><B>).</B></OL><H2><A NAME="Chapter"><FONT SIZE=5 COLOR=#FF0000>Chapter 17</FONT></A></H2><OL><LI>What is a command-line option?<BR><B>Command-line options (also called switches) turn on and offdifferent behaviors of the Perl interpreter.</B><LI>What are the two places that the switches can be specified?<BR><B>Switches can be placed either on the command line that invokesPerl or in the first line of the program.</B><LI>What switch should always be used?<BR><B>You should always use the -w switch to turn on the extendedwarning option.</B><LI>Which switch lets you read records that end with the ~ characterinstead of the newline?<BR><B>The -o switch lets you specify the record delimiter character.</B><LI>What two options can be used with the <TT>-n</TT>option?<BR><B>The -a and -F options can be used with the -n.</B><LI>How can you execute a script that someone sent you via e-mail?<BR><B>The -x option can be used to execute a script from the middleof the file.</B><LI>What happens if you specify both the <TT>-v</TT>and the <TT>-c</TT> options?<BR><B>The -v option displays the Perl version number and then the-c option checks the syntax of any Perl script specified on thecommand line.</B></OL><H2><A NAME="Chapter"><FONT SIZE=5 COLOR=#FF0000>Chapter 18</FONT></A></H2><OL><LI>What is a protocol?<BR><B>A protocol is a set of commands and responses.</B><LI>What is a socket?<BR><I><B>Sockets</B></I><B> are the low-level links that enable Internetconversations.</B><LI>What is the POP?<BR><B>Post Office Protocol-iNComing mail.</B><LI>Will client programs use the <TT>bind()</TT>fuNCtion?<BR><B>No.</B><LI>Do newly created sockets have an address?<BR><B>No.</B><LI>What is a port?<BR><B>A <I>Port</I> is an imaginary place where iNComing packetsof information can arrive (just like a ship arrives at a sea port).</B><LI>When sending the body or text of an e-mail message, will theserver respond after each line?<BR><B>Yes.</B><LI>Why shouldn't the echo service be used by Windows operatingsystems?<BR><B>Windows 95 (and perhaps other operating systems) can't usethe SIGALRM interrupt signal. This may cause problems if you usethis script on those systems because the program will wait foreverwhen a server does not respond.</B><LI>What is the largest NNTP reponse in terms of bytes?<BR><B>Unlimited.</B></OL><H2><A NAME="Chapter"><FONT SIZE=5 COLOR=#FF0000>Chapter 19</FONT></A></H2><OL><LI>Is CGI a programming language?<BR><B>No.</B><LI>Are CGI and Java the same type of protocol?<BR><B>No.</B><LI>Do CGI program files need to have the write turned on?<BR><B>No.</B><LI>What is the first line of output for CGI programs?<BR><B>An HTTP header.</B><LI>What information does the HTTP_USER_AGENT contain?<BR><B>It provides the type and version of the user's Web browser.</B><LI>Why is CGItap a useful program?<BR><B>It is a CGI debugging aid that can help pinpoint the problemin a troubling CGI application.</B></OL><H2><A NAME="Chapter"><FONT SIZE=5 COLOR=#FF0000>Chapter 20</FONT></A></H2><OL><LI>What does the acronym HTML stand for?<BR><B>Hypertext Markup Language.</B><LI>What are the <TT><H1>..</H1></TT>set of tags used for?<BR><B>It formats text as a first level heading.</B><LI>What is the down side of using SSI directives?<BR><B>They are very processor intensive.</B><LI>Can an HTML form have two submit buttons?<BR><B>No.</B><LI>Why should all angle brackets be replaced in form information?<BR><B>So that the Web browser doesn't think that a new HTML tag isstarting.</B><LI>How much text can be entered into a <TT><TEXTAREA></TT>input field?<BR><B>Unlimited.</B><LI>Can you debug a CGI script?<BR><B>Yes.</B></OL><H2><A NAME="Chapter"><FONT SIZE=5 COLOR=#FF0000>Chapter 21</FONT></A></H2><OL><LI>What is the access log used for?<BR><B>It records who and what accesses a specific HTML page or graphic</B>.<LI>Does the <TT>fullName</TT> fieldin the log file correspond to the user's mail address?<BR><B>No.</B><LI>Why is the status code of the log file entry important?<BR><B>To determine if unauthorized people are trying to access secured<BR>documents.</B><LI>Can you find log file analysis programs on the Internet?<BR><B>Yes.</B><LI>What good is a customized log file?<BR><B>To keep track of who executes your CGI scripts.</B><LI>What are two popular features of Web sites?<BR><B>The "What's New" page and the Feedback Form.</B><LI>What does recursion mean?<BR><B>A recursive fuNCtion calls itself in order to get work done.</B></OL><HR><CENTER><P><A HREF="ch22.htm"><IMG SRC="pc.gif" BORDER=0 HEIGHT=88 WIDTH=140></A><A HREF="#CONTENTS"><IMG SRC="cc.gif" BORDER=0 HEIGHT=88 WIDTH=140></A><A HREF="index.htm"><IMG SRC="hb.gif" BORDER=0 HEIGHT=88 WIDTH=140></A><A HREF="ch24.htm"><IMG SRC="nc.gif" BORDER=0 HEIGHT=88 WIDTH=140></A><HR WIDTH="100%"></P></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -