m1dib00@fed.frb.gov (Douglas I. Battenberg) (07/11/90)
I am trying to add a library of perl scripts to be evaluated by the "do EXPR" command. The man pages seem to indicate that this is done with the -I command line option so I did this to my main script: #! /usr/bin/perl -I/mq/home/bin/perl I printed @INC in my main script and got this: /mq/home/bin/ /usr/local/lib/perl Only the first thirteen characters of the directory were included. I tried using a directory path of less than thirteen characters but the script seems to ignore this additional entry in @INC. It finds things in /usr/local/lib/perl just fine. What am I missing here?
lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (07/12/90)
In article <M1DIB00.90Jul11114335@mqws8.fed.frb.gov> m1dib00@fed.frb.gov (Douglas I. Battenberg) writes:
: I am trying to add a library of perl scripts to be evaluated by the
: "do EXPR" command. The man pages seem to indicate that this is done
: with the -I command line option so I did this to my main script:
:
: #! /usr/bin/perl -I/mq/home/bin/perl
:
: I printed @INC in my main script and got this:
:
: /mq/home/bin/ /usr/local/lib/perl
:
:
: Only the first thirteen characters of the directory were included. I tried
: using a directory path of less than thirteen characters but the script seems
: to ignore this additional entry in @INC. It finds things in
: /usr/local/lib/perl just fine. What am I missing here?
That's all the kernel will pass--the allowed size of a switch is very small--
about 16 bytes. To do what you want, just modify @INC first thing in the
script:
#! /usr/bin/perl
unshift(@INC, '/mq/home/bin/perl');
do $whatever;
Should do the same thing. It won't help if you do #include with the C
preprocessor though, since that happens before the script starts executing.
Larry
merlyn@iwarp.intel.com (Randal Schwartz) (07/12/90)
In article <M1DIB00.90Jul11114335@mqws8.fed.frb.gov>, m1dib00@fed (Douglas I. Battenberg) writes: | What am I missing here? You are missing the not-well-documented fact that only a "small number" of characters (typically 32... I've never seen different) can be passed in a "#!..." startup line. See your local execve(2) manpage for details. What I do is: #!/local/usr/bin/perl push(@INC,"/local/merlyn/lib/perl"); if I want to invoke my own routines. Works wonders. print "Just another Perl hacker, working on The Book instead of signatures," -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/