Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: perl trigger's ending with 1?: msg#00030

version-control.clearcase.general

Subject: Re: perl trigger's ending with 1?

At 09:32 PM 6/10/2006, Bob Andriola wrote:
Anthony Ettinger wrote:
Is this necessary?

I see some triggers with a 1; at the end, and some without.
It's so that if no other "return" is encountered during execution, the trigger returns true (allowing the op that pulled the trigger to continue).

This is not quite correct. "Triggers", more properly "perl trigger scripts", and more generally "perl scripts", have no reason to end with 1; and they generally don't. The OP is probably getting confused with perl modules (as opposed to scripts) which do tend to end with 1;. The reason is given in "perldoc -f require":

The file must return true
as the last statement to indicate successful
execution of any initialization code, so it's
customary to end such a file with "1;" unless you're
sure it'll return true otherwise. But it's better
just to put the "1;", in case you add more statements.

So a module must return true, meaning a non-zero value. A pre-op trigger script, in order to not abort the CC operation, must exit true meaning a zero value. Note that returning and exiting are different concepts and their polarity is reversed.

Also, perl exit behavior is different from traditional shells. The default exit status of a shell script is that of the last command run whereas the default exit status of a perl script is always 0. This is why ending a script with 1; (or 437;) is meaningless; the exit status will still be zero unless "exit(n)" is called with n != 0.

-David Boyce


<============================================================
To unsubscribe, send email to
majordomo-XtjxT7Vmt5b1ENwx4SLHqw@xxxxxxxxxxxxxxxx and put these words in the
message body: unsubscribe cciug
============================================================>



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
qplus.devel/200...    network.jabber....    debian.qa-packa...    encryption.gpg....    python.dabo.dev...    uclinux.devel/2...    science.mathema...    recreation.pesc...    kernel.ck/2004-...    mozilla.devel.e...    tex.latex.prosp...    ietf.multi6/200...    bbc.cvs/2002-11...    xfree86.newbie/...    jakarta.taglibs...    altlinux.hardwa...    comedi/2002-05/...    horde.bugs/2004...    games.diplomacy...    finance.e-gold....    web.dom.test-su...    lang.ruby.rails...    os.netbsd.devel...    video.gstreamer...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation