[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: state of the cdrom mirrors report



Josip Rodin said:
> > > > Index: english/mirror/mirror_list.pl
> > > > ===================================================================
> > > > -open SRC, "<$mirror_source" ||
> > > > +open(SRC, "<$mirror_source") ||
> > > 
> > > Easy on the formatting... :)
> > 
> > That's not formatting, the || die will never be called even if the file
> > does not exist, unless you use parens. Perl parses || at a lower
> > precidence than comma.
> 
> Oh, I see. Maybe "or" would work the way it's intended? (I dislike the
> parens. :)

Think of it not as using parentheses to fix precedence, but to enclose
parameters to the open() call.  Then you might be happier.  In any case,
Joey is right.  The original line would only go to the || if the "<$.."
string returned null, which it can.  If you refer to the Perl docs you
will see that whenever a filehandle is specified with open(), then
parentheses will surround the arguments before "or die".

Andrew.

-- 
Andrew Shugg <andrew@neep.com.au>                   http://www.neep.com.au/

"Just remember, Mr Fawlty, there's always someone worse off than yourself."
"Is there?  Well I'd like to meet him.  I could do with a good laugh."



Reply to: