Skip Menu |

This queue is for tickets about the Tie-Array-Sorted CPAN distribution.

Report information
The Basics
Id: 8239
Status: resolved
Priority: 0/
Queue: Tie-Array-Sorted

People
Owner: Nobody in particular
Requestors: rrwo [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.3
Fixed in: (no value)



Subject: Attempts to sort empty arrays
I have maintain an array of objects, and have the following sort routine: sub mysort { $a->mymethod <=> $b->mymethod } Tie::Array::Sort and ::Lazy give the following error: Can't call method "mymethod" on an undefined value at ... where the line refers to the location of "mysort" in the code. The array does not seem to have undefined values. If I do not tie it, but run sory mysort @array when I'm done, it works fine. So I suspect that something is trying to call the comparitor on the empty array.
[guest - Thu Nov 4 09:06:08 2004]: Show quoted text
> I have maintain an array of objects, and have the following sort > routine: > sub mysort { $a->mymethod <=> $b->mymethod } > Tie::Array::Sort and ::Lazy give the following error: > Can't call method "mymethod" on an undefined value at ... > where the line refers to the location of "mysort" in the code.
I think you want $_[0] and $_[1] rather than $a and $b. If this isn't the case, can you try putting together a failing test case that I can run. Thanks, Tony