I have several perl programs:
mainApp.pl
subApp1.pl
subApp2.pl
they are all in one directory, say, /path/abc/bin/
One of them is the main application program: mainApp.pl, and all the others are called by the main script,but they are not libraries (in the format of functions), they are independent script and can be run individually as well. They are called in this way:
...
$command = "subApp1.pl -f $config_file";
$status = system( $command);
...
In Unix, I made all the scripts into executable, and add the path to the directory to PATH enviornment variable,then I can run the mainApp.pl from anywhere on the machine. IT works.
Then I tested it on windows, I also added the directory where all the scripts stays to the PATH enviornment variable, and run the mainApp.pl from an arbitrary directory. But as I run mainApp.pl to the point where subApp.pl is called, it said:
Can't open perl script "subApp1.pl": No such file or directory.
I don't want to hardcode the absolute path to my code. What can I do?
Thanks ahead.
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.