Skip Menu |

This queue is for tickets about the JSON CPAN distribution.

Report information
The Basics
Id: 26923
Status: resolved
Priority: 0/
Queue: JSON

People
Owner: Nobody in particular
Requestors: ryan.morris [...] sensage.com
Cc:
AdminCc:

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



Subject: JSON:NotString needs 'eq' overloading
Date: Thu, 3 May 2007 13:37:54 -0700
To: <bug-JSON [...] rt.cpan.org>
From: "Ryan Morris" <ryan.morris [...] sensage.com>
Greetings, I have ran into a case where some Perl code of mine was failing because it was unable to perform an 'eq' comparison on a JSON:NotString Object. I fixed it in my version by doing the following: Show quoted text
>>Paser.pm
package JSON::NotString; use overload ( '""' => sub { $_[0]->{value} }, 'bool' => sub { ! defined $_[0]->{value} ? undef : $_[0]->{value} eq 'false' ? 0 : 1; }, # Added eq 'eq' => sub { if (ref($_[1]) eq 'JSON::NotString') { return $_[0]->{value} eq $_[1]->{value}; } else { return $_[0]->{value} eq $_[1]; } }, ); I was wondering if you would consider fixing this in the main build? ---------- Ryan Morris Engineering - Apps
Thanks your report. I released v1.13 to which 'eq' , 'ne', '==' and '!=' operators were added.