On 4 Nov 2012, at 3:03 AM, John Delacour <j...@bd8.com> wrote: > I am a rank beginner in Xcode and Objective-C, very slowly getting to grips > with things using Xcode 4.5.1 in 10.8. My only significant experience is > with AppleScript and Perl and, so far as AppleScript is concerned, it looks > to me as though I’d be wiser to set it aside and work in straight C and ObjC. > > Perl is another matter altogether. While I am getting up to speed with Obj-C > I would like to be able to include Perl routines within projects, and I can > find very little on the WWW to be guided by.
So long as you understand that this isn't usually a productive thing to do. It may be a good idea as a stopgap to fill in parts you don't know how to do with Cocoa/Objective-C yet, but it's not a direction you'll want to stay on. (There was a project, CamelBones, that allowed you to do Cocoa programming mostly in Perl, but I'm sorry to learn its sponsor, Sherm Pendley, died last year, and no one else is maintaining it.) > So far I have experimented simply with > > system ("hard-coded/path/to/file") > > I have not yet even attempted anything with NSTask and found no way to add > Perl scripts to the project file tree and refer to them by relative path, so > you can see I am not very far forward! Time to learn NSTask, and NSBundle ([[NSBundle mainBundle] pathForResource: @"myscript" ofType: @"pl"]). In Xcode, use File > Add Files to "[project]"… (opt-cmd-A) to select your Perl files and add them to your project. Xcode will automatically copy them into the target bundle where the NSBundle methods can find them. > Any hints would be much appreciated. I shall doubtless have many more > questions of a more mainstream nature. — F -- Fritz Anderson -- Xcode 4 Unleashed: 4.5 supplement in editing -- <http://x4u.manoverboard.org/> _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com