I'm working on an application system that depends on being able to run scripts where you don't necessarily know exactly where they are. I'd really like to make is so you can just:
perl scriptname.pl arg1 agr2 ... argn
without necessarily knowing ahead of time which directory the script is in. By setting the PATH variable appropriately and putting '-S' in PERL5OPT I can almost get there. The fly in the ointment is that the scripts that can be found and run this way must have the execute bit set on them. Our system doesn't typically set the execute bits on the perl scripts that are a part of it, and I'd rather not introduce this requirement to the existing system.
So I'm seeking the wisdom of the monastery on this. Does anyone know of a way to accomplish this 'script name resolution' capability for scripts that don't have the execute bit set?
NB:
perl -S script_not_executable.pl
will find the script, but will then complain that script_not_executable.pl is not executable. Set the execute bit and it works.
--DrWhy
"If God had meant for us to think for ourselves he would have given us brains. Oh, wait..."
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.