Re: CamelBones question
Re: CamelBones question
- Subject: Re: CamelBones question
- From: Sherm Pendley <email@hidden>
- Date: Wed, 12 May 2004 20:48:24 -0400
On May 12, 2004, at 4:57 PM, Pierre Vaudrey wrote:
>
2004-05-12 22:52:28.546 Comments[10327] Perl error: Not an ARRAY
>
reference at
>
/Users/pierreva/Documents/perlGedcom/Comments/build/Comments.app/
>
Contents/Resources/CommentsWindowController.pm line 138.
>
line 138 is : if ($identifier eq 'comments') {
Perl can report misleading line numbers at times. I'm not sure if it's
a CamelBones issue or not - I've seen it happen in ordinary scripts
too.
Obviously line 138 is not where the error is - the error is reporting
an attempt to dereference something that isn't a reference, and nothing
of the sort is happening on line 138.
>
@{$self->{'comments'}} = sort { $a->{comments} cmp $b->{comments}
>
} @{$self->{'comments'}};
The problem is most likely on this line. In your earlier code, you used
$self->{'comments'} as an object reference, calling NSMutableArray
methods on it. Here, you're trying to use it as an array reference -
but it's not a reference to an array, hence the error.
You can use either OO methods or native Perl functions with Cocoa
arrays (and dictionaries) - but you can't use both with the same
variable. A given variable is either an object reference or a native
array, but it can't be both.
sherm--
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.