On Apr 24, 2006, at 5:19 PM, ravi wrote:
> At around 23/4/06 2:56 pm, Sherm Pendley wrote:
>> On Apr 21, 2006, at 3:48 PM, ravi wrote:
>>> Are there any examples of non-GUI Perl/CamelBones scripts that
>>> to another application? I want to write a Perl script that pulls
>>> from my LDAP server and populates it into AddressBook (run
>>> through cron).
>> Well, connecting to AddressBook is pretty easy:
>> use CamelBones qw(:All);
>> use AddressBook;
>> my $book = ABAddressBook->sharedAddressBook();
>> my $people = $book->people();
>> The way the above works is, CamelBones installs a "hook" in @INC
>> so that
>> if no Perl module is found for a use(), then CamelBones will
>> attempt to
>> load a framework bundle with the requested name and import its
>> Objective-C classes. So the "use AddressBook" above will load
>> AddressBook.framework and make the AB* classes visible to Perl.
> Sweet! How cool is that! Thanks for the pointer and example, Sherm.
> I am
> assuming that I can write into the AddressBook also, using this
One caveat - the above will only import classes & methods. It doesn't
import plain C-style functions, enums, or constants, unfortunately.
> One more (and thanks for your patience): any examples of dynamically
> creating widgets? I want to add a drawer to my GUI window,
> containing a
> set of checkboxes. The checkboxes are not static, however, and
> depend on
> an input config file (loaded at startup). So, the checkboxes in the
> drawer have to created at run-time. This I assume precludes using
> Interface Builder.
I've done something similar, although with text fields rather than
check boxes. My app had a list of named fields; each one could also
have the name of a formatter class. It could create a form with
titles & text fields, set up bindings between the view fields and the
model object fields, and if one was specified create and connect a
That was part of a larger project that's no longer active. I have a
copy of it on CD though - I'll see what kind of example or tutorial I
can make out of it.
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org