[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] perl tool under MPW - @INC behaviour



"D. Beverly" <slowdive@mindspring.com> wrote

>when invoking a script from MPW, if the script contains any use
>declarations ( eg. use Mac::Files ) or tries to directly access any lib
>routines ( eg. File::Copy ( $foo, $bar ) ), perl reports that it cannot
>find the file in @INC, as below...
>
deletia
>
> if I use this command line...
>
>>perl -I 'Teena:MacPerl Tool Ä:lib:' 'Tuesday:Desktop Folder:Cyberdog
>>Downloads:roundup.pl'
>
>...it works fine.
>
>I tried adding the following lines at the top of the script...
>
>>#!perl
>>$lib = "Teena:MacPerl Tool Ä:lib:";
>>unshift @INC, $lib;
>
>but this did not work when invoked without the -I arg, reporting the same
>error as above.
>
deletia
>
>So, is this a "feature" of the MacPerl tool (or MPW even), or am I just
>doing something wrong?
>
>Thanx,
>
>Dave Beverly
>Fayette Publishing Inc.
>

Perl needs to know the path to the libraries before the script is run - if you
want to modify the path to the library I think that you should put your
"unshift" code within a BEGIN block, so that Perl knows to do this prior to
"use"ing the library. Alternatively, you could use the newer method of
modifying the library path viz.

use lib ":Path:to:my:libs"

prior to the usage of the library.

Bob

________________________________________________________________
          Bob Wilkinson, Perl Programmer, Pindar plc
Tel: +44 (0)1904 613040    Email: B.Wilkinson@pindar.co.uk
Fax: +44 (0)1904 613110    URL: http://www.connection.co.uk/bob
________________________________________________________________
  I don't speak for my employer - er, they made me say that..
________________________________________________________________



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch