Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

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;
/dir1/dir2/dir3
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.

--Chris

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

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

Comment on Is there a Module that acts something like blib does?
Select or Download Code
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. :)

      --Chris

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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1069981]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2015-07-29 05:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls