Skip navigation.
 
ml@INC error when calling a perl script from NSTask
FROM : Nick Kocharhook
DATE : Thu Nov 21 22:18:01 2002

I have a perl script that I'm calling from an NSTask. The script
requires some modules that aren't standard, so I have included them in
the project. When I launch the NSTask, though, I get an @INC error
complaining that it can't find the modules.

Any ideas? TIA

====
NSTask *task = [[NSTask alloc] init];
NSPipe *pipe = [NSPipe pipe];

NSString *thisBundlePath = [[NSBundle bundleForClass:[self class]]
  bundlePath];
NSString *getLinks = [NSString
  stringWithFormat:@"%@/Contents/Resources/getLinks.pl",
  thisBundlePath];
NSString *perl = [NSString
  stringWithFormat:@"-I\"%@/Contents/Resources/Perl\"",
  thisBundlePath];

[task setStandardInput:pipe];
[task setLaunchPath:@"/usr/bin/perl"];
[task setArguments:[NSArray arrayWithObjects:perl, getLinks]];
[task launch];
====

And now for the perl error:

Can't locate HTML/TreeBuilder.pm in @INC (@INC contains:
"/Users/nick/Development/TD/build/TD.app/Contents/Resources/Perl"
/sw/lib/perl5/darwin /sw/lib/perl5 /sw/lib/perl5/darwin /sw/lib/perl5
/System/Library/Perl/darwin /System/Library/Perl /Library/Perl/darwin
/Library/Perl /Library/Perl /Network/Library/Perl/darwin
/Network/Library/Perl /Network/Library/Perl .) at
/Users/nick/Development/TD/build/TD.app/Contents/Resources/getLinks.pl
line 3.


Yes, the directories and files really are there:

[phillips:~/Development/TD/build] nick% find TD.app/ -name TreeBuilder.pm
TD.app//Contents/Resources/Perl/HTML/TreeBuilder.pm

--
Nick Kocharhook  --  <<email_removed>> -- Rot-13

Related mailsAuthorDate
ml@INC error when calling a perl script from NSTask Nick Kocharhook Nov 21, 22:18
mlRe: @INC error when calling a perl script from NSTask emoy Nov 21, 22:50
mlRe: @INC error when calling a perl script from NSTask Nick Kocharhook Nov 22, 00:15