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

[MacPerl] perl tool under MPW - @INC behaviour



I seem to remember seeing a post about this before, but I can't locate it now...

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...

>perl 'Tuesday:Desktop Folder:Cyberdog Downloads:roundup.pl'
># Can't locate Mac/Files.pm in @INC.
>File 'Tuesday:Desktop Folder:Cyberdog Downloads:roundup.pl'; Line 4
># BEGIN failed--compilation aborted.
>File 'Tuesday:Desktop Folder:Cyberdog Downloads:roundup.pl'; Line 4

 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.

I ran a test script that showed that @INC contained only ':', which turned out to be the cwd of MPW (which may be standard behaviour when running perl from a shell, in which case I'm just wasting a few seconds of your time here).

For the most part it's a trivial matter to add the -I switch when calling perl, but I'm wondering why prepending paths to @INC in the script itself doesn't seem to work when called from MPW?  Some of my scripts do just this, in which case it becomes slightly non-trivial to have to remember the lib search paths to pass from MPW (yes, I could move these lib folders into the main lib folder, but I shouldn't have to).  These scripts work fine using the MacPerl app.

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.

---
smash the control images...
smash the control machines...

just say no to Bill
(Gates or Clinton, take yer pick)


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