i don’t even know perl
Since I’ve been building software on my own for the last few months, I’ve been able to choose my technologies. (As opposed to building for someone else; in which case you’re probably told what you can use.)
I’ve been extremely impressed with the amount of information and code freely available out there. By using Other Peoples’ Code or at least Other Peoples’ Knowledge, I’ve been able to dissolve many man-months of development time. Yay internets!
So I will try to give back as I solve problems, going forward, just by posting what I learn.
I suppose in the near term I’ll post here, but I have a site and domain name for whatever fruits come from my little computer-geek renaissance here. I’ll switch to that eventually.
Right now, I want to embed a perl interpreter in my Cocoa app and run some perl code. There are apparently two already-working ways to do this. There’s Camelbones and there’s Apple’s PerlObjCBridge.
I’ve downloaded the former and may go that route, but would rather use Apple’s doo-dad ’cause it’s built-in and relatively light-weight. Camelbones will let you write OSX GUI apps in perl; I just want to run faceless perl code from a Cocoa app and get its output.
So my problem is that every reference to PerlObjCBridge I’ve found through google only talks about how to access the ObjC runtime from perl, and provides no example of how to go the other way: make a perl object in ObjC and tell it “go”. Every reference. I admit, it’s super-cool that your little perl program can be a first-class OSX citizen, but just tell me which header to include to do the other and I’ll be on my way.
I’ll post when I figure it out.
[update] - Okay, it looks like the way to bridge to perl from Cocoa with PerlObjCBridge is to launch an NSTask to run OS X’s built-in perl interpreter in a sort of client/server relationship. An adequate solution, but not quite what I’m looking for. Found this by downloading the MathServerDO example from this article.
January 23rd, 2006 at 11:07 am
[...] n Uncategorized by eric Monday January 23, 2006
Turns out getting CamelBones to do what I need isn’t as straightforward as one might hope, either. Meh. I’ve signed up for fe [...]
February 20th, 2006 at 8:26 pm
Thanks for posting this information. I was trying to find out exactly what you’re looking for, embedding perl inside Cocoa and not the other way around as Camelbones does.
September 8th, 2006 at 1:24 pm
So have you figured out how to do this yet? I too am looking all over google and only have found how to make these weird little .pm files run inside your cocoa app. I am trying literally to embed 1 single line of perl code into my program, already 100s of lines of cocoa. It seems like this should be easy, but I can’t figure it out. Any news?