]> git.imager.perl.org - imager.git/commitdiff
add overloaded eq to Imager::Matrix2d
authorTony Cook <tony@develop-help.com>
Fri, 14 Oct 2011 09:34:28 +0000 (20:34 +1100)
committerTony Cook <tony@develop-help.com>
Fri, 14 Oct 2011 09:34:28 +0000 (20:34 +1100)
since older perls don't seem to synthesize it from overloaded "".

Changes
lib/Imager/Matrix2d.pm

diff --git a/Changes b/Changes
index 326689b0e5ef7c065aca6c9d34ebc226ecb8363c..541c8af05cdf5846542856f838c9bc800f032809 100644 (file)
--- 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
 ==============
 
index d44e3b0aed26c44899279f1ceda813889a812505..d6a5a557b2f3edd410abb0995a7465d38a310541 100644 (file)
@@ -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.