• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Harnessing Perl Scripts within a Project
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Harnessing Perl Scripts within a Project


  • Subject: Re: Harnessing Perl Scripts within a Project
  • From: Fritz Anderson <email@hidden>
  • Date: Mon, 05 Nov 2012 14:44:51 -0600

On 4 Nov 2012, at 3:03 AM, John Delacour <email@hidden> 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 (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Harnessing Perl Scripts within a Project
      • From: John Delacour <email@hidden>
References: 
 >Harnessing Perl Scripts within a Project (From: John Delacour <email@hidden>)

  • Prev by Date: Re: Harnessing Perl Scripts within a Project
  • Next by Date: Re: This board is slow. Was: OS_OBJECT_USE_OBJC_RETAIN_RELEASE and xpc_release()
  • Previous by thread: Re: Harnessing Perl Scripts within a Project
  • Next by thread: Re: Harnessing Perl Scripts within a Project
  • Index(es):
    • Date
    • Thread