Getting Started - Hello, world!
The classic "Hello world!" program is more than just a tired introduction - it's one of the simplest possible programs that produce output. That makes it useful for testing your installation of the CamelBones framework. A more complicated program has a greater chance of having bugs of its own, making it difficult to be certain of the cause of any problems that crop up.
So, let's see if that copy of CamelBones you just installed is really working!
1. Create a project
Begin by starting Xcode (if you're using Panther) or Project Builder (if you're using 10.1 or Jaguar) and creating your new project. In the "New Application" dialog box, choose "Cocoa Application" in the section "Perl" from the list of project types. If you're using 10.1, choose "Cocoa Application (10.1)". After that, choose a name for your project ("Hello" would be a good choice for this one), and where you'd like to store the project files to finish the project creation.
2. Find and open the main window NIB
If you're using Xcode, expand the "Hello" item in the "Groups & Files" outline to the left by clicking on its disclosure triangle. Then select the "Resources" item under "Hello" by clicking once on it. Notice that selecting items in the outline affects the list of files that appear in the main part of the window - this can be a big help as more files are added to your project. Open "MainWindow.nib" in Interface Builder by double-clicking it, either in the list or the outline.
If you're using Project Builder, the left part of the window contains several tabs. Choose the "Files" tab to show an outline view of the files in your project that's similar to that found in Xcode. Expand the "Resources" group in this outline, and double-click the "MainWindow.nib" item. Unlike with Xcode, there is no list of files in the main part of the window, so double-clicking in the outline is the only way to open a file.
3. Add a text label to the main window
In Interface Builder, select the "Cocoa Views" ("Cocoa Text" in the Xcode version of IB) palette, and drag a text label from it onto the main window. There are several sizes of label to choose from - take your pick.
Double-click the text label in the main window to edit the text within it, and change the text to - wait for it - "Hello, world!" Or, change it to something else, if you're feeling particularly creative today. I won't be offended, I promise.
Be sure to save the changes you've made before switching back to Project Builder or Xcode.
4. Build and run your application
Build your application by clicking the "hammer" button in Project Builder or Xcode's tool bar. It may seem odd at first that you'd have to build your application - Perl is not, after all, a compiled language. But, your Perl code is stored in the application bundle as a resource, and the build process does more than just compile code - it also checks for modified resources that need to be copied into the application bundle.
Run your application by clicking the "Build and Run" button. In Xcode, this is the "hammer and green arrow" button, and in Project Builder it's the "hammer and monitor" button.