Hello
I'm trying to use modules. However use requires hard path or relative path from users path (path where user gives command not where the perl script actually is). However there seems to no way i can make the perl to include library (modules) dir relative to sript itself.
Eg. My script is in "/work/programs/bin/myscript.pl" and i have module in "/work/programs/perl_modules/Module.pm". Script has "use lib "../perl_modules" Now i'm giving command from "/home/hena" directory and the library include has "../perl_modules" but it is unable to find it.
I found an earlier posting on similar thing, which guided to use use "File::Spec::Functions qw(rel2abs);" and "use lib rel2abs($0);". This adds the script itself into path. But i'm still not able to give it the "../perl_modules" (i could remove script name with `dirname $0`) part.
I posted this question as anonymous monk, but then i lost the question and was unable to find it with search. So sorry for the reposting. Any help would be appreciated. Thanks.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.