• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CamelBones question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >Re: CamelBones question (From: Pierre Vaudrey <email@hidden>)

  • Prev by Date: Re: File Size and long longs...
  • Next by Date: Re: Unsigned Long Long
  • Previous by thread: Re: CamelBones question
  • Next by thread: glitch in my size code?
  • Index(es):
    • Date
    • Thread