On Aug 11, 2004, at 2:27 PM, Alan Olsen wrote:
The problem I am encountering is not in the Perl code so much as what needs to be connected where in XCode and Interface Builder. Either I am missing a delegate link or some other set of links in the toolkit. The examples do not help in this case because you have to go back into the interface builder and try and guess what links are made where and what is relevant in the particular case.
Elementary, my dear Watson. ;-)
Here's the line reporting the error:
$self->{'_preferences'}->{'Window'}->makeKeyAndOrderFront(undef);
Now, if $self->{'_preferences'} were undef, you'd be getting a different error when you tried to dereference it. You're not - the error you're getting is that the preferences hash ref doesn't have a key 'Window' in it, or the value associated with that key is undef.
So, two things to check:
First, make sure you've defined an outlet named 'Window' in your .pm file.
Second, make sure you've defined and connected the outlet in the .nib, in Interface Builder.
You might need to define the "File's Owner" class in IB, if you haven't already done so. Double-click the "File's Owner" to switch to the "classes" view. Select the "NSObject" class, and click the "Classes/Subclass NSObject" menu item. The default name for the new class is "MyObject" - enter the name of your owner class instead, i.e. "PerlButtonTest" in this case. Add whatever outlets and actions you want to the class definition, as described in the "Getting Started" tutorials.
Switch back to the "Instances" view, and select the "File's Owner". In the info panel, switch to the "Custom Class" pane, and select your owner class from the list.
Now you should be able to connect outlets and actions as described in the tutorials.
sherm--