From 5efba0c6203079c618e2284ad5f64e54dedb3888 Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Fri, 14 Oct 2011 20:34:28 +1100 Subject: [PATCH] add overloaded eq to Imager::Matrix2d since older perls don't seem to synthesize it from overloaded "". --- Changes | 3 +++ lib/Imager/Matrix2d.pm | 20 ++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index 326689b0..541c8af0 100644 --- a/Changes +++ b/Changes @@ -29,6 +29,9 @@ Bug fixes: - depend on Scalar::Util, since we use it and older perls don't have it. + - add overloaded eq to Imager::Matrix2d, since older perls don't seem + to synthesize it from overloaded "". + Imager 0.85_01 - 10 Oct 2011 ============== diff --git a/lib/Imager/Matrix2d.pm b/lib/Imager/Matrix2d.pm index d44e3b0a..d6a5a557 100644 --- a/lib/Imager/Matrix2d.pm +++ b/lib/Imager/Matrix2d.pm @@ -4,7 +4,7 @@ use vars qw($VERSION); use Scalar::Util qw(reftype looks_like_number); use Carp qw(croak); -$VERSION = "1.009"; +$VERSION = "1.0010"; =head1 NAME @@ -61,7 +61,8 @@ require 'Exporter.pm'; use overload '*' => \&_mult, '+' => \&_add, - '""'=>\&_string; + '""'=>\&_string, + "eq" => \&_eq; =item identity() @@ -374,6 +375,21 @@ sub _string { $out; } +=item _eq + +Implement the overloaded equality operator. + +Provided for older perls that don't handle magic auto generation of eq +from "". + +=cut + +sub _eq { + my ($left, $right) = @_; + + return $left . "" eq $right . ""; +} + =back The following functions are shortcuts to the various constructors. -- 2.39.5