Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Is there a Module that acts something like blib does?

by taint (Chaplain)
on Jan 09, 2014 at 16:11 UTC ( #1069981=perlquestion: print w/replies, xml ) Need Help??
taint has asked for the wisdom of the Perl Monks concerning the following question:

Greetings, Monks.

I asked a similar question awhile back, and while I appreciated the replies. I never was able to find an ideal solution. Here's hoping...

Anyway, if you're working within web space, and you want to create/use small utility type Modules you've built. But don't want to "install" them. What are you to do? In other words; you want to create a "lib" type folder out of your web root to use (a|pre)pend to your @INC. This is easily accomplished, if you're calling it within your web root;

use lib ('Utils');
But not so easy, as you traverse deeper into the directory hierarchy, eg;
because now, Utils is 2 dir's back. So Perl complains, and your Util lib isn't used. What's a person to do? I've looked at useing blib. But that will possibly traverse (backwards) too far, into territory I don't want the web server/users to necessarily have access to. Further; it's intended for CLI use, with the -M. Given that I won't necessarily know how deep Perl might be, and when I do, I still don't want to have to prepend X amount of dots to the use lib. Is there, aside from actually installing it/them, a more elegant way to hande such situations? Or better, has anyone the knowledge of a Module that already does this sort of thing?

Thank you for all your time, and consideration.


EDIT: I forgot to also mention, I also looked at FindBin.

λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH

Replies are listed 'Best First'.
Re: Is there a Module that acts something like blib does?
by Anonymous Monk on Jan 09, 2014 at 16:21 UTC
    ?? File::FindLib - Find and use a file/dir from a directory above your script file

    What are you to do?

    Stop making life hard for yourself?

      Thanks tye! ++

      You're the best! File::FindLib is exactly what the doctor ordered. :)


      λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1069981]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2018-06-19 16:05 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (114 votes). Check out past polls.