Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!bu.edu!nntp-read!composer From: composer@chem.bu.edu (Jeff Kellem) Newsgroups: comp.lang.perl Subject: Re: requires vs do expr. (PL 44) Message-ID: Date: 6 Mar 91 14:17:28 GMT References: <1991Mar6.032242.4660@ccu1.aukuni.ac.nz> Sender: news@bu.edu.bu.edu Reply-To: composer@chem.bu.edu Organization: Boston University Chemistry Department Lines: 28 In-reply-to: russell@ccu1.aukuni.ac.nz's message of 6 Mar 91 03:22:42 GMT In article <1991Mar6.032242.4660@ccu1.aukuni.ac.nz> russell@ccu1.aukuni.ac.nz (Russell J Fulton;ccc032u) writes: > I have tried to include this file into the other scripts with both require > and do but have found querks which ever way I did it. > > Firstly 'do expr' gives no indication of failure if the file indicated by > 'expr' does not exits or can not be opened. (Is this a bug or a feature?) Actually "do EXPR" does give indication of an error via $@. In the book, look at page 115. So, you can check $@ to see if the "do EXPR" succeeded or failed. Something like: die $@ if $@; > These are as much as anything a shortcoming of the documentation so please > can the next edition of the book have some more details on how to use > require and a warning to test for the presence of the target of 'do expr'. Yeah, it probably should have a better pointer in the documentation, since $@ isn't mentioned in the description of "do EXPR". As for "require" it is documented using a Perl implementation of "require".. ;-) Cheers... -jeff Jeff Kellem Internet: composer@chem.bu.edu