I need to use a perl script to communicate with a running OS X app (that I am developing). The app doesn't need to communicate back to the script. What are some simple / clean ways to do this?
            Asked
            
        
        
            Active
            
        
            Viewed 143 times
        
    0
            
            
        - 
                    This question requires opinion to answer, as there are many options available. Opinion questions are problematic at stack overflow, not the least reason of which: to express an opinion it needs to have some reasonable basis, and the description you've given leaves no foundation for such a basis. – mah Apr 16 '14 at 20:18
 - 
                    @mah updated question to clarify. – Tom Hamming Apr 16 '14 at 20:28
 - 
                    How frequent is this communication, and what's the payload like size-wise? – jscs Apr 16 '14 at 20:32
 - 
                    @JoshCaswell quite small. The purpose is to feed it paths of files to process. – Tom Hamming Apr 16 '14 at 20:40
 
1 Answers
3
            
            
        Here are a few possible solutions:
- Perl opens up ZMQ socket and the OS X app uses the objective-c bindings to read that queue
 - Writing Perl XS that can interact with NSNotificationCenter provided by apple(also see this SO discussion here). There seems to be a replica of NSNotificationCenter written in Perl here.
 - OSX seems to come with a Perl<==>ObjC bridge which you can find more about here
 - Your ObjC app listens on a socket and Perl connects and writes to it. See some examples here and here
 - Use pipes as described here
 - Use unix sockets for IPC between Perl and Objc (see this for objc and this for Perl )
 - Use UNIX Message queues(described here in Beej's Guide)
 - Write Perl XS bindings for libdispatch (aka grand-central-dispatch) or use Inline::C in Perl to access the libdispatch API