[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

RE: [ID 20000125.002] Problem in documentation of Fcntl constants



>>>>> "Warren" == Warren Odom <warren-odom@stenocall.com> writes:

Warren> The point is, a literal reading of the documentation (and
Warren> isn't that how it's supposed to be read?) states that integer
Warren> addition is the proper way to combine these constants, when in
Warren> fact not only is it not good practice-but also just plain
Warren> doesn't work.

<<But it *does* work.  You just happened to stumble into a combination
of factors... that the AUTOLOADed constants can get parsed in an
unexpected way.
2 + 4 is 2 | 4.  Same value.  Adding works fine.>>

I'm not sure how to respond to this, because your example is not an
illustration of what I'm talking about.  Yes, 2 + 4 is the same as 2 | 4,
but the point is, we've seen clearly that LOCK_EX + LOCK_NB is not the same
as LOCK_EX | LOCK_NB.  Adding of those Fcntl symbolic constants (in various
contexts, including the context for which they are specifically designed)
doesn't work (and by that I mean it gives the wrong answer, implying 2 + 4 =
2 or 4 + 2 = 4, depending on the ordering of the constants).  The reason it
fails (unexpected parsing) doesn't matter.

And since every other Perl reference says use OR, and since it's an
easy--almost trivial--change, what's the problem with bringing the
"official" documentation in line with them?  If I stumbled into this
situation, others will too.  In fact, according to his newsgroup posting,
Larry Rosler already stumbled into it a few months ago.

           -- Warren



References to:
merlyn@stonehenge.com (Randal L. Schwartz)

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]