我是Cocoa的初学者。我试图从我的班级执行一个perl脚本,我没有得到任何结果,下面是代码:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMast, YES);
NSString *documentDir = [paths objectAtIndex:0];
NSString *path = [documentDir stringByAppendingPathComponent:@"detect.pl"];
NSMutableArray *someArray = [[NSMutableArray alloc] initWithObjects:path, nil];
[[NSTask launchedTaskWithLaunchPath:[NSString stringWithFormat:@"/usr/bin/pl"] arguments:someArray] waitUntilExit];
我收到以下文字
pl {-input <file>} {-output <file>}
Reads ASCII PL from stdin (or file if -input specified)
and writes ASCII PL to stdout (or file if -output)
NOTE: binary serialization is no longer supported
代码的执行就在那里停止。我不确定我做错了什么,有人可以指出我正确的方向。感谢。
答案 0 :(得分:3)
您需要执行/usr/bin/perl
,而不是/usr/bin/pl
。