亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? ch13.htm

?? prrl 5 programs codes in the book
?? HTM
?? 第 1 頁 / 共 3 頁
字號(hào):

This line of code displays

<BLOCKQUOTE>

<PRE>

No such file or directory at test.pl line 2.

</PRE>

</BLOCKQUOTE>

<P>

This error message is a bit more informative. It's even better

if you append the text , <TT>stopped</TT>

to the error message like this:

<BLOCKQUOTE>

<PRE>

chdir('/user/printer') or die(&quot;$!, stopped&quot;);

</PRE>

</BLOCKQUOTE>

<P>

which displays

<BLOCKQUOTE>

<PRE>

No such file or directory, stopped at test.pl line 2.

</PRE>

</BLOCKQUOTE>

<P>

Appending the extra string makes the error message look a little

more professional. If you are really looking for informative error

messages, try this:

<BLOCKQUOTE>

<PRE>

$code = &quot;chdir('/user/printer')&quot;;

eval($code) or die(&quot;PROBLEM WITH LINE: $code\n$! , stopped&quot;);

</PRE>

</BLOCKQUOTE>

<P>

which displays the following:

<BLOCKQUOTE>

<PRE>

PROBLEM WITH LINE: chdir('/user/printer')

No such file or directory , stopped at test.pl line 3.

</PRE>

</BLOCKQUOTE>

<P>

The <TT>eval()</TT> fuNCtion is discussed

in the section, &quot;Example: Using the <TT>eval()</TT>

FuNCtion,&quot; later in this chapter. Therefore, I won't explain

what this code is doing other than to say that the <TT>eval()</TT>

fuNCtion executes its arguments as semi-isolated Perl code. First,

the Perl code in <TT>$code</TT> is

executed and then, if an error arises, the Perl code in <TT>$code</TT>

is displayed as text by the <TT>die()</TT>

fuNCtion.

<P>

If you don't want <TT>die()</TT> to

add the script name and line number to the error, add a newline

to the end of the error message. For example:

<BLOCKQUOTE>

<PRE>

chdir('/user/printer') or die(&quot;$!\n&quot;);

</PRE>

</BLOCKQUOTE>

<P>

displays the following

<BLOCKQUOTE>

<PRE>

No such file or directory

</PRE>

</BLOCKQUOTE>

<H3><A NAME="ExampleUsingtheTTFONTSIZEFACECourierwarnFONTTTFONTSIZEFuNCtionFONT">

Example: Using the <TT>warn()</TT>

FuNCtion</FONT></A></H3>

<P>

The <TT>warn()</TT> fuNCtion has the

same fuNCtionality that <TT>die()</TT>

does except the script is not exited. This fuNCtion is better

suited for nonfatal messages like low memory or disk space conditions.

The next example tries to change to the <TT>/text</TT>

directory. If the connect fails, the consequeNCes are not fatal

because the files can still be written to the current directory.

<BLOCKQUOTE>

<PRE>

chdir('/text') or warn(&quot;Using current directory instead of /text, 

</FONT><FONT SIZE=2 FACE="ZapfDingbats">&Acirc;</FONT><FONT SIZE=2 FACE="Courier">warning&quot;);

</PRE>

</BLOCKQUOTE>

<P>

This line of code displays

<BLOCKQUOTE>

<PRE>

Using current directory instead of /text, warning at test.pl line 2.

</PRE>

</BLOCKQUOTE>

<P>

if the <TT>/text</TT> directory does

not exist. As with <TT>die()</TT>,

you can eliminate the script name and line number by ending your

error message with a newline. You could also use the <TT>$!</TT>

variable to display the system error message.

<H2><A NAME="TrappingFatalErrors"><FONT SIZE=5 COLOR=#FF0000>

Trapping Fatal Errors</FONT></A></H2>

<P>

There are times when reporting fatal errors and then exiting the

script are not appropriate responses to a problem. For example,

your script might try to use the <TT>alarm()</TT>

fuNCtion, which is not supported in some versions of Perl. Normally,

using an unsupported fuNCtion causes your problem to exit, but

you can use the <TT>eval()</TT> fuNCtion

to trap the error and avoid ending the script.

<P>

The <TT>eval()</TT> fuNCtion accepts

an expression and then executes it. Any errors generated by the

execution will be isolated and not affect the main program. However,

all fuNCtion definitions and variable modifications do affect

the main program.

<H3><A NAME="ExampleUsingtheTTFONTSIZEFACECourierevalFONTTTFONTSIZEFuNCtionFONT">

Example: Using the <TT>eval()</TT>

FuNCtion</FONT></A></H3>

<P>

You can use the <TT>eval()</TT> fuNCtion

to trap a normally fatal error:

<BLOCKQUOTE>

<PRE>

eval { alarm(15) };

warn() if $@;



eval { print(&quot;The print fuNCtion worked.\n&quot;); };

warn() if $@;

</PRE>

</BLOCKQUOTE>

<P>

This program displays the following:

<BLOCKQUOTE>

<PRE>

The Unsupported fuNCtion alarm fuNCtion is unimplemented at test.pl line 

&nbsp;2.

        ...caught at test.pl line 3.

The print fuNCtion worked.

</PRE>

</BLOCKQUOTE>

<P>

The <TT>$@</TT> special variable holds

the error message, if any, returned by the execution of the expression

passed to the <TT>eval()</TT> fuNCtion.

If the expression is evaluated correctly, then <TT>$@</TT>

is an empty string. You probably remember that an empty string

is evaluated as false when used as a conditional expression.

<P>

In an earlier section, &quot;Example: Using the <TT>die()</TT>

FuNCtion,&quot; you saw the following code snippet being used:

<BLOCKQUOTE>

<PRE>

$code = &quot;chdir('/user/printer')&quot;;

eval($code) or die(&quot;PROBLEM WITH LINE: $code\n$! , stopped&quot;);

</PRE>

</BLOCKQUOTE>

<P>

This program shows that <TT>eval()</TT>

will execute a line of code that is inside a variable. You can

use this capability in many different ways besides simply trapping

fatal errors. The program in Listing 13.2 presents a prompt and

executes Perl code as you type it. Another way of looking at this

program is that it is an interactive Perl interpreter.

<P>

<IMG SRC="pseudo.gif" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/pseudo.gif" BORDER=1 ALIGN=RIGHT><p>

<BLOCKQUOTE>

<I>Loop until the user enters </I><TT><I>exit</I></TT><I>.

<BR>

Print the prompt.<BR>

Get a line of input from </I><TT><I>STDIN</I></TT><I>

and remove the ending linefeed.<BR>

Execute the line.<BR>

If the executed code set the </I><TT><I>$@</I></TT><I>

error message variable, display the error message as a warning.</I>

</BLOCKQUOTE>

<HR>

<BLOCKQUOTE>

<B>Listing 13.2&nbsp;&nbsp;13LST02.PL-Using Perl Interactively

<BR>

</B>

</BLOCKQUOTE>

<BLOCKQUOTE>

<PRE>

do {

    print(&quot;&gt; &quot;);

    chop($_ = &lt;&gt;);

    eval($_);

    warn() if $@;

} while ($_ ne &quot;exit&quot;);

</PRE>

</BLOCKQUOTE>

<HR>

<P>

When you run this program, you will see a <TT>&gt;</TT>

prompt. At the prompt, you can type in any Perl code. When you

press Enter, the line is executed. You can even define fuNCtions

you can use later in the interactive session. The program can

be stopped by typing <TT>exit</TT>

at the command line.

<P>

If you like powerful command-line environments, you can build

on this small program to create a personalized system. For example,

you might need to perform a backup operation before leaving work.

Instead of creating a batch file (under DOS) or a shell file (under

UNIX), you can add a new command to the Perl interactive program,

as in Listing 13.3.

<P>

<IMG SRC="pseudo.gif" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/pseudo.gif" BORDER=1 ALIGN=RIGHT><p>

<BLOCKQUOTE>

<I>Loop until the user enters </I><TT><I>exit</I></TT><I>.

<BR>

Print the prompt.<BR>

Get a line of input from </I><TT><I>STDIN</I></TT><I>

and remove the ending linefeed.<BR>

If the inputted line begins with </I><TT><I>do#</I></TT><I>,

then a custom command has been  entered.<BR>

Process the </I><TT><I>do#backup</I></TT><I>

custom command.<BR>

See if the user needs help.<BR>

Otherwise, use the </I><TT><I>eval()</I></TT><I>

fuNCtion to execute the inputted line.<BR>

If the executed code set the </I><TT><I>$@</I></TT><I>

error message variable, display the error message as a warning.</I>

</BLOCKQUOTE>

<HR>

<BLOCKQUOTE>

<B>Listing 13.3&nbsp;&nbsp;13LST03.PL-An Interactive Perl Interpreter

that Understands Custom Commands<BR>

</B>

</BLOCKQUOTE>

<BLOCKQUOTE>

<PRE>

sub backItUp {

    '\backup /user/*';

    'delete /user/*.bak'

}



sub help {

    print(&quot;do#backup will perform the nightly backup\n&quot;);

    print(&quot;help will display this message.\n\n&quot;);

}



do {

    print(&quot;&gt; &quot;);

    chop($_ = &lt;&gt;);

    if (/^do#/) {

        backItUp)() if /backup/;

    }

    elsif (/^\s*help/) {

        help();

    }

    else {

        eval($_);

        warn() if $@;

    }

} while ($_ ne &quot;exit&quot;);

</PRE>

</BLOCKQUOTE>

<HR>

<P>

This program invokes the backup program and deletes the backup

files if you enter <TT>do#backup</TT>

at the <TT>&gt;</TT> prompt. Of course,

you need to modify this program to perform the customized commands

you'd like to have. This technique also enables you to centralize

your administrative tasks, which will make them easier to document

and maintain.<BR>

<p>

<CENTER>

<TABLE BORDERCOLOR=#000000 BORDER=1 WIDTH=80%>

<TR><TD><B>Tip</B></TD></TR>

<TR><TD>

<BLOCKQUOTE>

If you are running Perl on a DOS or Windows machine, consider replacing your small batch utility programs with one Perl interpreter and some customized commands. This saves on hard disk space if you use a lot of batch files because each file may take up 
to 4,096 bytes, regardless of its actual size.</BLOCKQUOTE>



</TD></TR>

</TABLE>

</CENTER>

<P>

<H2><A NAME="WhatIsaSignal"><FONT SIZE=5 COLOR=#FF0000>

What Is a Signal?</FONT></A></H2>

<P>

<I>Signals</I> are messages sent by the operating system to the

process running your Perl script. At any time, a signal that must

be answered can be sent to your process. Normally, a default handler

is used to take care of a signal. For example, under Windows 95,

when you press the Ctrl+C key combination, your process is sent

an <TT>INT</TT> or interrupt signal.

The default handler responds by ending the process and displays

the following message:

<BLOCKQUOTE>

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
宅男噜噜噜66一区二区66| 欧美日韩在线不卡| 亚洲国产aⅴ成人精品无吗| 欧美一区二区三区四区在线观看| 丰满放荡岳乱妇91ww| 日韩中文字幕av电影| 国产精品国产三级国产普通话蜜臀| 欧美理论在线播放| 成人自拍视频在线| 麻豆精品久久精品色综合| 亚洲欧美区自拍先锋| 国产拍欧美日韩视频二区| 欧美一区二区三区免费大片| 99久久精品国产观看| 国产精品视频观看| 国产精品网站在线观看| 成人免费视频视频在线观看免费| 三级一区在线视频先锋 | 国产日韩欧美不卡在线| 欧美绝品在线观看成人午夜影视| 91免费看`日韩一区二区| 国产精品影视网| 美日韩一级片在线观看| 日韩国产精品大片| 亚洲成人av在线电影| 亚洲人成网站影音先锋播放| 中文字幕不卡一区| 久久精品男人天堂av| 日韩女优制服丝袜电影| 欧美精品久久99久久在免费线| 色88888久久久久久影院野外| www.欧美色图| 成人av在线播放网站| 国产精品香蕉一区二区三区| 精品亚洲成a人在线观看| 欧美性xxxxx极品少妇| 色噜噜夜夜夜综合网| 91在线精品一区二区| 波多野结衣91| 91香蕉视频污在线| 色综合久久中文字幕| 91视频免费看| 在线观看亚洲专区| 在线亚洲欧美专区二区| 欧美日韩高清在线| 9191成人精品久久| 精品久久久久久久久久久久久久久| 日韩一区二区三区视频在线观看 | 欧美一区二区三区在线观看视频| 欧美日韩免费高清一区色橹橹| 欧美日韩久久久久久| 欧美丰满嫩嫩电影| 日韩欧美一级二级三级久久久| 亚洲精品在线一区二区| 久久久不卡影院| 国产精品无遮挡| 亚洲激情第一区| 视频一区在线视频| 狠狠色丁香久久婷婷综| 国产成人在线看| 色婷婷av久久久久久久| 欧美日本在线一区| 精品久久久三级丝袜| 中文字幕成人在线观看| 亚洲精品高清视频在线观看| 亚洲bt欧美bt精品| 精品一区二区三区视频| 99久久精品免费| 91精品久久久久久久99蜜桃| 久久日一线二线三线suv| 国产精品国产馆在线真实露脸| 一区二区三区免费| 美国av一区二区| 成人午夜在线免费| 欧美日韩国产高清一区二区三区| 久久综合色之久久综合| 国产精品久久久久久久久搜平片| 亚洲影视资源网| 久草中文综合在线| 91在线精品一区二区| 91精品国产品国语在线不卡| 国产亚洲欧美激情| 亚洲一区二区三区中文字幕| 九九九久久久精品| 色诱视频网站一区| 欧美精品一区二区三区蜜桃视频 | 欧美性xxxxxxxx| 久久色在线观看| 亚洲一区二区三区四区在线| 国产在线精品免费av| 色噜噜狠狠成人中文综合| 欧美va在线播放| 亚洲国产婷婷综合在线精品| 久久av资源站| 欧美系列亚洲系列| 国产欧美久久久精品影院| 五月激情六月综合| av电影在线观看完整版一区二区| 日韩午夜在线观看| 一区二区三区免费看视频| 国产成人日日夜夜| 91精品国产综合久久婷婷香蕉| 中文字幕视频一区二区三区久| 狠狠色丁香婷综合久久| 制服丝袜日韩国产| 亚洲伊人色欲综合网| 成人av免费在线观看| 欧美mv和日韩mv国产网站| 一区二区不卡在线视频 午夜欧美不卡在| 韩国av一区二区三区| 91麻豆精品国产91久久久久久久久 | 日韩电影免费在线看| 色综合一区二区| 中文字幕在线播放不卡一区| 国产在线播放一区| 日韩欧美三级在线| 日本免费新一区视频| 91麻豆6部合集magnet| 国产精品午夜在线| 国产成人丝袜美腿| 国产亚洲一本大道中文在线| 欧美电影在哪看比较好| 一区二区三区四区不卡在线| 91在线一区二区三区| 国产精品第五页| 不卡一区在线观看| 欧美激情资源网| 国产成人精品一区二| 久久综合狠狠综合久久综合88 | 日本韩国精品在线| 国产精品成人免费精品自在线观看 | 91麻豆精品国产91久久久久久| 亚洲成av人影院在线观看网| 欧美在线视频你懂得| 夜夜嗨av一区二区三区| 色婷婷亚洲一区二区三区| 亚洲乱码精品一二三四区日韩在线| 成人动漫视频在线| 亚洲欧洲另类国产综合| av亚洲精华国产精华精华| 国产精品美女久久久久久久久久久| 国产成人啪免费观看软件| 国产精品免费视频观看| 成人激情av网| 成人免费视频在线观看| 色呦呦网站一区| 亚洲一区二区三区视频在线 | 91国偷自产一区二区三区成为亚洲经典| 国产精品久久夜| 91年精品国产| 亚洲一区二区三区美女| 欧美一区二区三区在线| 精品在线观看视频| 国产日本欧美一区二区| 91免费看片在线观看| 天天免费综合色| 精品欧美黑人一区二区三区| 国产成人午夜精品5599| 亚洲欧美日韩在线不卡| 欧美日韩国产123区| 韩国精品主播一区二区在线观看 | 91在线观看下载| 亚洲bt欧美bt精品777| 精品免费视频.| 97aⅴ精品视频一二三区| 亚洲综合一二三区| 日韩欧美国产成人一区二区| 大桥未久av一区二区三区中文| 综合色中文字幕| 91精品午夜视频| 粉嫩欧美一区二区三区高清影视| 亚洲女同女同女同女同女同69| 欧美久久久久中文字幕| 国产资源在线一区| 亚洲欧美aⅴ...| 日韩一区二区免费电影| 成人精品视频一区二区三区尤物| 伊人开心综合网| 欧美videos中文字幕| 色网综合在线观看| 免费人成精品欧美精品 | 亚洲电影激情视频网站| 欧美电影免费观看高清完整版在| 成人avav在线| 免费不卡在线观看| 亚洲精品免费在线播放| 日韩三级在线免费观看| 99久久伊人精品| 视频一区在线视频| 最新欧美精品一区二区三区| 欧美一区二区三区在线观看视频| 成人福利视频在线| 日本大胆欧美人术艺术动态 | 洋洋av久久久久久久一区| 欧美v亚洲v综合ⅴ国产v| 在线视频观看一区| 盗摄精品av一区二区三区| 蜜臀av一区二区在线观看 | 日韩电影在线一区二区三区| 国产精品视频第一区|