Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Restricting @INC for specific application need

by mr_mischief (Monsignor)
on Mar 06, 2008 at 05:02 UTC ( #672357=note: print w/replies, xml ) Need Help??

in reply to Restricting @INC for specific application need

You don't really ever know where the "standard" Perl module directory is, do you? I can override any paths using configure. I can have multiple directories included for past point releases. I can have vendor lib directories (which are used by many Linux distributions (because the distribution is packaged to be reliable across many installations for many users, and many distributions use all sorts of Perl in their distributions-specific tools (like urpmi on Mandriva))).

Given those caveats, if you can get your code to be more reliable rather than less reliable by doctoring your lib paths and you don't intend to mess with the defaults for other programs, then I think every option is open to you.

I'll give you a bit of free advice about common wisdom that not enough people seem to grasp. There are conventions, best practices, and recommendations enough that work well enough for most people in most situations. Usually, it's a good idea to follow the collective wisdom of a well-experienced, thoughtful group. When all the cards are down, so to speak, your chips depend on having the best hand at the table and not a pretty good one on average. If you're finding that you have an odd requirement that falls outside of the common wisdom, then perhaps you're right to have an odd solution. You'd just better be right about it, or someone's going to call you a fool when your system falls down and you have to explain why you stepped outside the norm. If you can make your system ten times as reliable by breaking convention, then do it and document the decision process. If you're making it 100% harder for another Perl programmer to take over the project later for a 5% increase in reliability under someone who knows the whole custom installation and configuration process, you'll be canned and for good reason.

  • Comment on Re: Restricting @INC for specific application need

Replies are listed 'Best First'.
Re^2: Restricting @INC for specific application need
by naikonta (Curate) on Mar 06, 2008 at 16:10 UTC
    Long before this distro showers, I always knew that the "standard" Perl module directory started with /usr/lib/perl5. Whenever I installed Perl myself, I never felt the need to reconfigure @INC or other stuff, except once or twice for debugging and thread options. Why? Because I always intented to replace Perl (including non-core modeuls, if any) came with the distro. Before I leave this old history, just in case it rang a bell, I just want to emphasize that "I always wonder why Linux distros...." is not a real question. I can understand the reason behind distros decision, I just don't like the result.
    You don't really ever know where the "standard" Perl module directory is, do you?
    If you really asked me refering to the Perl installation shipped with a random distro, my answer was: I would never be sure until I did some test or lookup.

    So, put the long story short, eventually, only this application in this particular distribution that sets @INC in such way. I believe this @INC hackery (borrowed from Tanktalus) won't affect other systems I don't need or don't have any interest to control.

    I know it's against common practices, it's against my standard practices as well. I think the hard part with my OP is that it tries to force a frame, unusual frame of thinking. Now I can see it fails :-) That's why I said earlier that "Let's put aside for a while the debate around....". I kinda expected typical reactions I got so far, which I'm grateful for because it lets me know my sanity level (or, is it my insanity level?)

    If you can make your system ten times as reliable by breaking convention, then do it and document the decision process
    I will, and thanks for reminding me. My OP is absolutely part of the docs :) The lengty was mostly to accommodate my intention to share what I went through during the process of the decision making. The part I apologized because I realized it might end up useless to anybody else.

    Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!

      It is kind of a pain to install a second perl alongside the distro's perl installation to keep from breaking things, but I've found it worthwhile for the polish and reliability I get with the management tools for my distro.

      I don't think your original post fails at all. I'm a big believer that common wisdom should be used in common situations, but that sometimes it falls down. You just need to be careful about when and how you break the rules and make sure there's actual benefit from it. I can't speak to your case very directly, because I'm not as familiar with your situation as you are. From what you've said, though, you may have one of those situations in which it's worthwhile to write an exception in your local copy of the rules. Just be sure you write it legibly, and, well, cover your behind.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://672357]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2020-01-28 00:54 GMT
Find Nodes?
    Voting Booth?