Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: use lib in cgi env

by fullermd (Priest)
on Nov 06, 2012 at 00:15 UTC ( #1002403=note: print w/ replies, xml ) Need Help??


in reply to use lib in cgi env

I have a common little snippet I drop at the top of a lot of projects, to set use lookup paths relative to the running binary.

my $rundir; BEGIN { use File::Basename; $rundir = dirname($0); } use lib "$rundir/lib";

Then you can have

/any/old/random/place/script.pl /any/old/random/place/lib/Foo.pm

and just use Foo, relocating the whole project at will. Obviously not perfect against the case of you running the script via alternate hardlinks or such, but...


Comment on Re: use lib in cgi env
Select or Download Code
Replies are listed 'Best First'.
Re^2: use lib in cgi env
by AlexTape (Monk) on Nov 08, 2012 at 10:17 UTC
    thank you! thats what i looked for..
    $perlig =~ s/pec/cep/g if 'errors expected';

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2015-07-31 04:23 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 (274 votes), past polls