Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re^3: use lib $lib_dir not working

by tinita (Parson)
on Apr 28, 2011 at 08:31 UTC ( #901750=note: print w/replies, xml ) Need Help??

in reply to Re^2: use lib $lib_dir not working
in thread use lib $lib_dir not working

that FindBin is broken

well. the objections against FindBin I read so far always have to do with using FindBin after you changed the directory. If I had a script somewhere in my repository that does a chdir in a BEGIN block and if such a weird thing is really necessary, I can place FindBin even before that BEGIN block and everything's fine. If the script uses a module that does a chdir in a BEGIN block then I probably have other problems anyway.

So if you know what you're doing IMHO FindBin is handy and safe enough. Do you always use $[ instead of 0 just because a script could set it somewhere? ;-)

Replies are listed 'Best First'.
Re^4: use lib $lib_dir not working
by tye (Sage) on Apr 28, 2011 at 13:24 UTC

    Then it is too bad that you can't be bothered to read an objection when it is a single click away and yet still feel the need to respond (in ignorance).

    - tye        

      Sorry, that link isn't clear at all. It states that FindBin does something of which you don't see the value, so you call it perverse.

      But you didn't give a concrete example of where it actually fails, or gives a wrong answer.

      If your explanations aren't easy to understand, how about making them clearer instead of berating others for trying to understand them, and actually asking sensible questions about them?

        It appears that my making fun of FindBin may not be all that you had difficulty understanding.

        instead of berating others for trying to understand them, and actually asking sensible questions about them?

        The question asked couldn't have been about my write-up. Why not? Because tinita clearly didn't read the write-up. The question tinita asked was (though only indirectly) about complaints of early chdir in relation to FindBin. I had absolutely no complaint about that particular problem (in a reply, merlyn raised the opposite objection, just in case that leads you to more confusion). So tinita was not "asking a sensible question about" "my explanation".

        And tinita wrote "the objections against FindBin I read so far always have to do with using FindBin after you changed the directory". So, clearly, the linked-to write-up is not one of "the objections" tinita has "read so far". So tinita wrote a response without bothering to read (other than the title of) the linked-to write-up.

        I am at a bit of a loss how you could interpret what I wrote above as a complaint about somebody "trying to understand". I thought it was extremely clear as berating somebody for responding without even bothering to read the offered objection (which is quite the opposite of "trying to understand").

        If I had to guess, I might theorize you have formed some negative opinion of me which colors your interpretation and greatly interferes with your ability to understand. But inferring emotional state from text-only communication is horribly error prone so I don't put any weight behind the idea of such and only mention it to note that if such does exist, then you might be wise to consider its impact on your understanding. I apologize in advance if that guess is far from the mark and the broaching of the subject was upsetting to you.

        In any case, I hope the above was successful in "making [my berating] clearer".

        In anticipation of what I hope is a baseless prediction, I'll note that my repeated use of quoting is simply an attempt to tie my explanation very closely and clearly to exactly the points that I am responding to. I can imagine them being interpreted as an attempt at mocking the quoted phrases. That is not my intent. I feel the extra directness is warranted as I find your response so starkly at odds with what was stated that it seems likely that at least one of us has significantly misunderstood the other. I hope that being explicit about the connections between the phrases will either aid you in discovering where you misinterpreted my remarks or make more apparent where I misinterpreted your (or tinita's) remarks.

        If your explanations aren't easy to understand,

        I freely admit that there is a significant problem with the title of my write-up as far as aiding an easy understanding of the write-up. But I will also admit to not minding that sometimes a lazy attempt at understanding ("easy") will fail and, as a result, some will not understand and others will be forced to go beyond a lazy attempt at understanding and exert some effort, trying "hard" to understand.

        Had I actually berated somebody for failing to understand, then I could justify being berated for the combination of the thing being not easy to understand and for me berating. So I offer no criticism of your choice to berate me (since it seems clear that you thought that was what I had done).

        It states that FindBin does something of which you don't see the value, so you call it perverse.

        True, I "don't see the value" in doing something that is completely pointless (searching $ENV{PATH}). If that is your primary interpretation of my write-up, then I suggest you try harder to understand it or resign yourself to not understanding it and then perhaps just refrain from trying to summarize it.

        But you didn't give a concrete example of where it actually fails, or gives a wrong answer.

        True. In part, because that is quite beside the point. A naive (even "easy") interpretation of the title could certainly lead somebody to expect or hope for such a thing to be provided. I have several times considered that the title choice was unfortunate, because the main point is not that FindBin is "broken" in the most common meaning of "broken". To some extent, it is less than that: FindBin is perverse in several ways. But it is also more than that because FindBin is broken in a more fundamental way than it just "not working" or "failing" or "giving wrong answers": The whole basis for it is a broken assumption.

        I find FindBin quite amusing.

        It reminds me very much of:

        my $elements= @array.length()/10;

        If I presented such code to you and your response was to concentrate on concrete cases where it would give the wrong answer, then I would assert that you missed the point, to a great degree. A response of "that gives the wrong answer if $_ contains a non-empty string" would be rather practical on one level, but seems quite the wrong response, IMHO.

        Changing that code to:

        my $elements= do { local( $_ )= ''; @array.length()/10; };

        quite nicely addresses the practical considerations. It does nothing to address the perverseness nor to address the rather clear underlying false assumption.

        That code is pretty "broken" in some fundamental ways. It still gives the right answer most of the time. I don't recommend you use it. I certainly avoid it.

        - tye        

      you probably never considered that I simply did not find other objections, maybe because I did not - and do not - understand part of the article correctly.
      Accusing me of not having read the article at all is probably not the best way to make your point.

        You read the article that was given as explanation of why somebody had stopped using FindBin and completely failed to even find why that article would be considered a criticism of FindBin [and the thread contained a reply claiming that FindBin worked /better/ when chdir was done too soon]... and after that you wrote:

        well. the objections against FindBin I read so far always

        [and then went on to talk about how FindBin can /fail/ when chdir is done too soon]

        No, I didn't spend much time considering that. The quoted part reads exactly like you didn't read this objection. Even now, you repeat that you didn't think you had read an objection. So it is rather funny to then complain about me "accusing" you of not having read something when you note that you indeed thought that you hadn't read any such thing (and so wrote as if you had not /read/).

        And being pointed to an objection and reading it and finding no objection there and responding by talking about other objections is still "responding from ignorance". I personally consider responding from ignorance to be rather rude behavior. I gather not everybody feels that way.

        I won't actually accuse you not having considered something, trying to be more polite than that. But, in future, if you have no clue why a link was offered in justification, you might want to mention that as part of your response. Otherwise, when you indirectly express your belief that you didn't read an objection after a link to an objection was offered, somebody might think that you didn't bother to read the offered objection. Talk about "not the best way to make your point". :)

        - tye        

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://901750]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (10)
As of 2017-08-18 13:52 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (303 votes). Check out past polls.