In my app, I put all the modules in one directory , let's just call it libx
.
Since it's up to the user to choose where to deploy the app, I don't want to hardcode the lib
path.
So at the beginning of myapp.pl
, I wrote the following lines of code.
#! /usr/bin/perl -w
use strict;
my $curr_dir = $0;
my $curr_lib = $curr_dir;
$curr_lib =~ s/myapp\.pl/libx/;
use $curr_lib ;
Instead of getting what I'm expecting, I got compiling errors!
So what's wrong with my code? I don't want to hardcode the lib path when using use lib
, how should I do this?
Sorry I forgot to mention that when the app is deployed, myapp.pl
and libx
are in the same directory.