From: Christoph N. <en...@ap...> - 2001-03-23 02:18:20
|
Jose, $mesg->code && die $mesg->error; That would be a common perlism for do the first part, and if it succeeds, then do the second part. You can also do that in UNIX shell. It's based on the order the operands are evaluted in an "AND" expression. Since Perl uses short circuit evaluation, it will only evaluate as little as possible to determine the true of a statment. In an "AND" statment, if the first part of the expression returns false, the second part does not need to be evaluated. - Christoph On Fri, 23 Mar 2001, Graham Barr wrote: > ----- Forwarded message from Jose Olivares <JAO...@LB...> ----- > > Date: Thu, 22 Mar 2001 09:45:55 -0800 > To: gb...@po... > From: Jose Olivares <JAO...@LB...> > Subject: Net::LDAP > X-Mailer: Mozilla 4.75C-CCK-MCD LBNL V4.73 Build 2 (Macintosh; U; PPC) > > Hi Graham - > > My name is Jose Olivares and I have just gotten access to the Net::LDAP > module for Perl. > > I have done lots of programming, but I have not done any object oriented > > programming. I am however quite familiar with concepts like > subroutines (methods in OOP?), data structures (objects?), etc. > > I am looking at the writeup for Net::LDAP. Under the Synopsis section > are a couple of examples. I can understand the code pretty much, even > if > I don't know the exact actions that are happening. However, there is a > piece that mystifies me. There is a line that says: > > $mesg->code && die $mesg->error; > > I can see that "$mesg->code" refers to a success or failure return code > and it > looks like the "die $mesg->error" part puts out the error message that > is in > the $mesg structure (I assume it is a structure). But taken together I > don't > really understand the above statement. What is the statement doing and > how > does it know what to do? > > Thanks. > > - Jose Olivares > > > ----- End forwarded message ----- > > |