Hello community,

here is the log from the commit of package perl-Math-BigInt for 
openSUSE:Factory checked in at 2015-09-30 05:52:11
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Math-BigInt (Old)
 and      /work/SRC/openSUSE:Factory/.perl-Math-BigInt.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Math-BigInt"

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Math-BigInt/perl-Math-BigInt.changes        
2015-09-24 06:16:19.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.perl-Math-BigInt.new/perl-Math-BigInt.changes   
2015-09-30 05:52:18.000000000 +0200
@@ -1,0 +2,21 @@
+Sat Sep 26 08:53:16 UTC 2015 - co...@suse.com
+
+- updated to 1.999704
+   see /usr/share/doc/packages/perl-Math-BigInt/CHANGES
+
+  2015-09-25 v1.999704 pjacklam
+  
+    * objectify() in lib/Math/BigInt.pm now uses 'isa' not 'eq' to check object
+      relationship. This is necessary for correct handling of subclasses.
+  
+    * objectify() in lib/Math/BigInt.pm no longer expects as_int(), as_number()
+      and as_float() to return objects, but allows them to return numbers
+      formatted as strings. This is used by some other modules on CPAN.
+  
+    * Better documentation of as_int() and as_number() in lib/Math/BigInt.pm.
+  
+    * Add documentation for as_float() in lib/Math/BigFloat.pm
+  
+    * Added test files t/objectify_mbf.t and t/objectify_mbi.t.
+
+-------------------------------------------------------------------

Old:
----
  Math-BigInt-1.999703.tar.gz

New:
----
  Math-BigInt-1.999704.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Math-BigInt.spec ++++++
--- /var/tmp/diff_new_pack.dVwuMt/_old  2015-09-30 05:52:19.000000000 +0200
+++ /var/tmp/diff_new_pack.dVwuMt/_new  2015-09-30 05:52:19.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           perl-Math-BigInt
-Version:        1.999703
+Version:        1.999704
 Release:        0
 %define cpan_name Math-BigInt
 Summary:        Arbitrary size integer/float math package

++++++ Math-BigInt-1.999703.tar.gz -> Math-BigInt-1.999704.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Math-BigInt-1.999703/CHANGES 
new/Math-BigInt-1.999704/CHANGES
--- old/Math-BigInt-1.999703/CHANGES    2015-09-21 19:36:52.000000000 +0200
+++ new/Math-BigInt-1.999704/CHANGES    2015-09-25 15:13:24.000000000 +0200
@@ -1418,6 +1418,21 @@
  * Add test files t/blog-mbf.t and t/blog-mbi.t for better testing of the
    blog() methods.
 
+2015-09-25 v1.999704 pjacklam
+
+  * objectify() in lib/Math/BigInt.pm now uses 'isa' not 'eq' to check object
+    relationship. This is necessary for correct handling of subclasses.
+
+  * objectify() in lib/Math/BigInt.pm no longer expects as_int(), as_number()
+    and as_float() to return objects, but allows them to return numbers
+    formatted as strings. This is used by some other modules on CPAN.
+
+  * Better documentation of as_int() and as_number() in lib/Math/BigInt.pm.
+
+  * Add documentation for as_float() in lib/Math/BigFloat.pm
+
+  * Added test files t/objectify_mbf.t and t/objectify_mbi.t.
+
 Please send us test-reports, your experiences with this and your ideas - we 
love
 to hear about our work!
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Math-BigInt-1.999703/MANIFEST 
new/Math-BigInt-1.999704/MANIFEST
--- old/Math-BigInt-1.999703/MANIFEST   2015-09-21 19:52:56.000000000 +0200
+++ new/Math-BigInt-1.999704/MANIFEST   2015-09-25 15:20:23.000000000 +0200
@@ -65,6 +65,8 @@
 t/mbimbf.t
 t/nan_cmp.t
 t/new_overloaded.t
+t/objectify_mbf.t
+t/objectify_mbi.t
 t/req_mbf0.t
 t/req_mbf1.t
 t/req_mbfa.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Math-BigInt-1.999703/META.json 
new/Math-BigInt-1.999704/META.json
--- old/Math-BigInt-1.999703/META.json  2015-09-21 19:52:55.000000000 +0200
+++ new/Math-BigInt-1.999704/META.json  2015-09-25 15:20:22.000000000 +0200
@@ -38,6 +38,6 @@
       }
    },
    "release_status" : "stable",
-   "version" : "1.999703",
+   "version" : "1.999704",
    "x_serialization_backend" : "JSON::PP version 2.27300"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Math-BigInt-1.999703/META.yml 
new/Math-BigInt-1.999704/META.yml
--- old/Math-BigInt-1.999703/META.yml   2015-09-21 19:52:50.000000000 +0200
+++ new/Math-BigInt-1.999704/META.yml   2015-09-25 15:20:19.000000000 +0200
@@ -20,5 +20,5 @@
     - inc
 requires:
   perl: '5.006002'
-version: '1.999703'
+version: '1.999704'
 x_serialization_backend: 'CPAN::Meta::YAML version 0.016'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Math-BigInt-1.999703/SIGNATURE 
new/Math-BigInt-1.999704/SIGNATURE
--- old/Math-BigInt-1.999703/SIGNATURE  2015-09-21 19:53:02.000000000 +0200
+++ new/Math-BigInt-1.999704/SIGNATURE  2015-09-25 15:20:26.000000000 +0200
@@ -16,16 +16,16 @@
 
 SHA1 f6ef98e8f3f6a4f670d569f279ef5a3c05c16d0c BENCHMARK
 SHA1 d681b992c9e027633a59fbd52530805ee4e1621c BUGS
-SHA1 6b566f5d8c537a75d173e1845d330a020b06ddab CHANGES
+SHA1 8ea50abf4bd86783767a277d9578f06e78fc7e56 CHANGES
 SHA1 f27c8bd98e754f96c9825fa6ce9f1244c93bdbe6 CREDITS
 SHA1 bc2db74538d3acd53f71b5512a144fe18c253ecd GOALS
 SHA1 fe61299e80a1dca48fbaa33f0869e3238ec07c70 HISTORY
 SHA1 c42565ad26cdf91502bacf19a4f7080e63c51fe2 INSTALL
 SHA1 d6a6c30ee6d9ba6b9afab8bbf6a25e1b23c744e0 LICENSE
-SHA1 8f6a77cdcfede79a3fcf27549b2b8739eaefbfe8 MANIFEST
+SHA1 183f44987a5dfba10182b1b89f1f92647e388a5f MANIFEST
 SHA1 86df44fbe1ea7a68897113f0e327d0f0c25b91e3 MANIFEST.SKIP
-SHA1 43cf33ae05d036694ebfe2987e31217140278c9e META.json
-SHA1 3cec127e47b24f6b3b0a21c8a6fc67aec2f3916a META.yml
+SHA1 27f71484021cedc3ac0c8d0776279f88610ba004 META.json
+SHA1 926b03441e37ae13d3dc24a081fda22d2990b7c5 META.yml
 SHA1 ae1e2767f1988a537d4a64fc84a07587cbca2ef5 Makefile.PL
 SHA1 4e2191d1724e699862efc5350f480c8e02755112 NEW
 SHA1 481f5827752d2100914db1eaeb60bf0bbd13529e README
@@ -41,10 +41,10 @@
 SHA1 2e33e87882d60db3913da6284dd5295e5315e18a inc/Module/Install/Metadata.pm
 SHA1 c830b819e61bda5eca077c6291293bba61b3b9f2 inc/Module/Install/Win32.pm
 SHA1 cb52b9d6f88d512d448a6f35ed0af0d1201a134b inc/Module/Install/WriteAll.pm
-SHA1 d69e58dac458d7bd76c7fb6182d50e7005fcca6d lib/Math/BigFloat.pm
-SHA1 7bc1a3b537261121d93d275431bd86c45c0c6e5e lib/Math/BigInt.pm
-SHA1 92b2144f0032d651cf1e7d3b37a82b01010febac lib/Math/BigInt/Calc.pm
-SHA1 193c0c6d9b83e783b8071b8bbeee3f5bc0dcfddd lib/Math/BigInt/CalcEmu.pm
+SHA1 2b4a6499b7f55d6bb33cb942bdf83853d094b404 lib/Math/BigFloat.pm
+SHA1 b11a534087024e20f724475d2648d259fc03eb1b lib/Math/BigInt.pm
+SHA1 964d54429022e659b55e1b236041bccaa0fc74ba lib/Math/BigInt/Calc.pm
+SHA1 70d46d848ba40caa86372df20efd3fac47d0e29c lib/Math/BigInt/CalcEmu.pm
 SHA1 385cc7ed3bf3e6290640b9880445ca9a3dea629e t/00sig.t
 SHA1 4463fdcebb8421cc2e63f87d678adb47856bf58c t/01load.t
 SHA1 b2ed9206ca5b69ec3b8bbf850bf4b6dfde518e7e t/02pod.t
@@ -84,6 +84,8 @@
 SHA1 b13701babf6c3952a0b8de3803de838d52a13ddc t/mbimbf.t
 SHA1 a8e152beb9c0583cca8ba397ca2952cf456f107c t/nan_cmp.t
 SHA1 852bfc6c25fa982e0c48e270277f091732d062e2 t/new_overloaded.t
+SHA1 7b8ad0d8e8bb1afb985d3af119bcd284a2ae105f t/objectify_mbf.t
+SHA1 2a4e13c9a6a4f1c155d223e29b162e95c2722198 t/objectify_mbi.t
 SHA1 4c28c03a8e373c03a0246548394588855e4173b9 t/req_mbf0.t
 SHA1 1317f0500ac902cff77d78ea92b2b72dbf188331 t/req_mbf1.t
 SHA1 4ce690af449cd6382b1372d4bacacb2781e91574 t/req_mbfa.t
@@ -112,11 +114,11 @@
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
-iQEcBAEBAgAGBQJWAEP5AAoJEGcmPl2fr166vegH/0Qm1Z/66sNEhc2jGhRjhlVv
-aC2Y76G29bA7TkYhvVNxKZQ0imPBsLINr84jvAPynuwzdKa13EJX46sA1MUW3fmp
-ciT4BNoAqv48WUmukh67cm2p/lwNsmA4h4Tz8u7jgDH2r4Ilsh1pUZg6eKTUHLtJ
-3Hg3EYAqHuJKtrZQLzECmPpArNDYbHhcQbVI/mhqyIvKTne+qWDbxcvu9YKsAFHp
-XwwgOH+PVmqsFiosM6W9FeR8bLnHmTntFFvKKk+Wns4Qo2y0Gxxcq5KwxNgfgoz2
-dzWZtdzPqpXEWeqCEDYOMYC/lWu/fCcVamZfyBhTHaTubvari63DsB2hViwSZRc=
-=G3gV
+iQEcBAEBAgAGBQJWBUoXAAoJEGcmPl2fr166VgEIANnEsYBpwPSRz2gQhWKYyzAs
+2c23b3RmyMA3VmnapfjRCpIZkFEmqHo0Pl/QwDBlNN00RN00cZHdwJ9s8dhNSZyJ
+rE+Xdi0kc/I6D4EVXSf25AqH7VymZRoJzkX+IPqj7xFw7HmdIKraMwXY7CLsN+Fm
+WhcnX6Pbr6D5+C6tNX6yLmjZyTnl7CaqO5Beq49OH23nHTzY2247rowumoH1PpTu
+XIOArzhazregnPcb4sV6boqnZtFwosOGZmr8cWT82HGGyFhYhh1rokpYr/08RecI
+RBdipu8M2qsbsKTHl0mAhc0AYXp0p8gZW1zGnMX55JH21h9uXZlJw3iLnhYvGTY=
+=w70R
 -----END PGP SIGNATURE-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Math-BigInt-1.999703/lib/Math/BigFloat.pm 
new/Math-BigInt-1.999704/lib/Math/BigFloat.pm
--- old/Math-BigInt-1.999703/lib/Math/BigFloat.pm       2015-09-21 
09:29:13.000000000 +0200
+++ new/Math-BigInt-1.999704/lib/Math/BigFloat.pm       2015-09-22 
15:22:03.000000000 +0200
@@ -12,7 +12,7 @@
 #   _a : accuracy
 #   _p : precision
 
-$VERSION = '1.999703';
+$VERSION = '1.999704';
 require 5.006002;
 
 require Exporter;
@@ -945,17 +945,17 @@
 
   if ($done) {
       if ($fallback) {
-          # clear a/p after round, since user did not request it
+        # clear a/p after round, since user did not request it
           delete $x->{_a};
           delete $x->{_p};
-      }
+        }
       return $x;
-  }
+      }
 
   # when user set globals, they would interfere with our calculation, so
   # disable them and later re-enable them
   no strict 'refs';
-  my $abr = "$self\::accuracy";  my $ab = $$abr; $$abr = undef;
+  my $abr = "$self\::accuracy"; my $ab = $$abr; $$abr = undef;
   my $pbr = "$self\::precision"; my $pb = $$pbr; $$pbr = undef;
   # we also need to disable any set A or P on $x (_find_round_parameters took
   # them already into account), since these would interfere, too
@@ -971,7 +971,7 @@
     $x = Math::BigFloat->new($x);
     $self = ref($x);
     }
-
+  
   $done = 0;
 
   # If the base is defined and an integer, try to calculate integer result
@@ -4435,6 +4435,24 @@
 
 This method was added in v1.87 of Math::BigInt (June 2007).
 
+=item as_float()
+
+This method is called when Math::BigFloat encounters an object it doesn't know
+how to handle. For instance, assume $x is a Math::BigFloat, or subclass
+thereof, and $y is defined, but not a Math::BigFloat, or subclass thereof. If
+you do
+
+    $x -> badd($y);
+
+$y needs to be converted into an object that $x can deal with. This is done by
+first checking if $y is something that $x might be upgraded to. If that is the
+case, no further attempts are made. The next is to see if $y supports the
+method C<as_float()>. The method C<as_float()> is expected to return either an
+object that has the same class as $x, a subclass thereof, or a string that
+C<ref($x)-E<gt>new()> can parse to create an object.
+
+In Math::BigFloat, C<as_float()> has the same effect as C<copy()>.
+
 =back
 
 =head1 Autocreating constants
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Math-BigInt-1.999703/lib/Math/BigInt/Calc.pm 
new/Math-BigInt-1.999704/lib/Math/BigInt/Calc.pm
--- old/Math-BigInt-1.999703/lib/Math/BigInt/Calc.pm    2015-09-19 
14:23:35.000000000 +0200
+++ new/Math-BigInt-1.999704/lib/Math/BigInt/Calc.pm    2015-09-22 
15:22:46.000000000 +0200
@@ -4,7 +4,7 @@
 use strict;
 # use warnings;        # do not use warnings for older Perls
 
-our $VERSION = '1.999703';
+our $VERSION = '1.999704';
 
 # Package to store unsigned big integers in decimal and do math with them
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Math-BigInt-1.999703/lib/Math/BigInt/CalcEmu.pm 
new/Math-BigInt-1.999704/lib/Math/BigInt/CalcEmu.pm
--- old/Math-BigInt-1.999703/lib/Math/BigInt/CalcEmu.pm 2015-09-19 
14:24:20.000000000 +0200
+++ new/Math-BigInt-1.999704/lib/Math/BigInt/CalcEmu.pm 2015-09-22 
15:22:46.000000000 +0200
@@ -5,7 +5,7 @@
 # use warnings;        # do not use warnings for older Perls
 use vars qw/$VERSION/;
 
-$VERSION = '1.999703';
+$VERSION = '1.999704';
 
 package Math::BigInt;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Math-BigInt-1.999703/lib/Math/BigInt.pm 
new/Math-BigInt-1.999704/lib/Math/BigInt.pm
--- old/Math-BigInt-1.999703/lib/Math/BigInt.pm 2015-09-19 15:33:21.000000000 
+0200
+++ new/Math-BigInt-1.999704/lib/Math/BigInt.pm 2015-09-22 15:22:03.000000000 
+0200
@@ -18,7 +18,7 @@
 my $class = "Math::BigInt";
 use 5.006002;
 
-$VERSION = '1.999703';
+$VERSION = '1.999704';
 
 @ISA = qw(Exporter);
 @EXPORT_OK = qw(objectify bgcd blcm); 
@@ -2826,9 +2826,7 @@
 
         # If it is an object of the right class, all is fine.
 
-        if ($ref -> isa($a[0])) {
-            next;
-        }
+        next if $ref -> isa($a[0]);
 
         # Upgrading is OK, so skip further tests if the argument is upgraded.
 
@@ -2836,27 +2834,44 @@
             next;
         }
 
-        # If we want a Math::BigInt, see if the object can become one.
-        # Support the old misnomer as_number().
+        # See if we can call one of the as_xxx() methods. We don't know whether
+        # the as_xxx() method returns an object or a scalar, so re-check
+        # afterwards.
+
+        my $recheck = 0;
 
-        if ($a[0] eq 'Math::BigInt') {
+        if ($a[0] -> isa('Math::BigInt')) {
             if ($a[$i] -> can('as_int')) {
                 $a[$i] = $a[$i] -> as_int();
-                next;
-            }
-            if ($a[$i] -> can('as_number')) {
+                $recheck = 1;
+            } elsif ($a[$i] -> can('as_number')) {
                 $a[$i] = $a[$i] -> as_number();
-                next;
+                $recheck = 1;
             }
         }
 
-        # If we want a Math::BigFloat, see if the object can become one.
-
-        if ($a[0] eq 'Math::BigFloat') {
+        elsif ($a[0] -> isa('Math::BigFloat')) {
             if ($a[$i] -> can('as_float')) {
                 $a[$i] = $a[$i] -> as_float();
+                $recheck = $1;
+            }
+        }
+
+        # If we called one of the as_xxx() methods, recheck.
+
+        if ($recheck) {
+            $ref = ref($a[$i]);
+
+            # Perl scalars are fed to the appropriate constructor.
+
+            unless ($ref) {
+                $a[$i] = $a[0] -> new($a[$i]);
                 next;
             }
+
+            # If it is an object of the right class, all is fine.
+
+            next if $ref -> isa($a[0]);
         }
 
         # Last resort.
@@ -4351,15 +4366,29 @@
 
     $x->copy();                # make a true copy of $x (unlike $y = $x;)
 
-=item as_int()/as_number()
+=item as_int()
+
+=item as_number()
 
-    $x->as_int();
+These methods are called when Math::BigInt encounters an object it doesn't know
+how to handle. For instance, assume $x is a Math::BigInt, or subclass thereof,
+and $y is defined, but not a Math::BigInt, or subclass thereof. If you do
 
-Returns $x as a BigInt (truncated towards zero). In BigInt this is the same as
-C<copy()>.
+    $x -> badd($y);
 
-C<as_number()> is an alias to this method. C<as_number> was introduced in
-v1.22, while C<as_int()> was only introduced in v1.68.
+$y needs to be converted into an object that $x can deal with. This is done by
+first checking if $y is something that $x might be upgraded to. If that is the
+case, no further attempts are made. The next is to see if $y supports the
+method C<as_int()>. If it does, C<as_int()> is called, but if it doesn't, the
+next thing is to see if $y supports the method C<as_number()>. If it does,
+C<as_number()> is called. The method C<as_int()> (and C<as_number()>) is
+expected to return either an object that has the same class as $x, a subclass
+thereof, or a string that C<ref($x)-E<gt>new()> can parse to create an object.
+
+C<as_number()> is an alias to C<as_int()>. C<as_number> was introduced in
+v1.22, while C<as_int()> was introduced in v1.68.
+
+In Math::BigInt, C<as_int()> has the same effect as C<copy()>.
 
 =item bstr()
 
@@ -4390,7 +4419,7 @@
 This returns a normal Perl scalar from $x. It is used automatically
 whenever a scalar is needed, for instance in array index operations.
 
-This loses precision, to avoid this use L<as_int()|/"as_int()/as_number()"> 
instead.
+This loses precision, to avoid this use L</as_int()> instead.
 
 =item modify()
 
@@ -5415,43 +5444,34 @@
 
 =item Mixing different object types
 
-In Perl you will get a floating point value if you do one of the following:
-
-       $float = 5.0 + 2;
-       $float = 2 + 5.0;
-       $float = 5 / 2;
-
-With overloaded math, only the first two variants will result in a BigFloat:
+With overloaded operators, it is the first (dominating) operand that determines
+which method is called. Here are some examples showing what actually gets
+called in various cases.
 
        use Math::BigInt;
        use Math::BigFloat;
 
-       $mbf = Math::BigFloat->new(5);
-       $mbi2 = Math::BigInteger->new(5);
-       $mbi = Math::BigInteger->new(2);
-
+       $mbf  = Math::BigFloat->new(5);
+       $mbi2 = Math::BigInt->new(5);
+       $mbi  = Math::BigInt->new(2);
                                        # what actually gets called:
-       $float = $mbf + $mbi;           # $mbf->badd()
-       $float = $mbf / $mbi;           # $mbf->bdiv()
-       $integer = $mbi + $mbf;         # $mbi->badd()
-       $integer = $mbi2 / $mbi;        # $mbi2->bdiv()
-       $integer = $mbi2 / $mbf;        # $mbi2->bdiv()
-
-This is because math with overloaded operators follows the first (dominating)
-operand, and the operation of that is called and returns thus the result. So,
-Math::BigInt::bdiv() will always return a Math::BigInt, regardless whether
-the result should be a Math::BigFloat or the second operant is one.
-
-To get a Math::BigFloat you either need to call the operation manually,
-make sure the operands are already of the proper type or casted to that type
-via Math::BigFloat->new():
+        $float = $mbf + $mbi;           # $mbf->badd($mbi)
+        $float = $mbf / $mbi;           # $mbf->bdiv($mbi)
+        $integer = $mbi + $mbf;         # $mbi->badd($mbf)
+        $integer = $mbi2 / $mbi;        # $mbi2->bdiv($mbi)
+        $integer = $mbi2 / $mbf;        # $mbi2->bdiv($mbf)
+
+For instance, Math::BigInt->bdiv() will always return a Math::BigInt, 
regardless of
+whether the second operant is a Math::BigFloat. To get a Math::BigFloat you
+either need to call the operation manually, make sure each operand already is a
+Math::BigFloat, or cast to that type via Math::BigFloat->new():
 
        $float = Math::BigFloat->new($mbi2) / $mbi;     # = 2.5
 
-Beware of simple "casting" the entire expression, this would only convert
-the already computed result:
+Beware of casting the entire expression, as this would cast the
+result, at which point it is too late:
 
-       $float = Math::BigFloat->new($mbi2 / $mbi);     # = 2.0 thus wrong!
+       $float = Math::BigFloat->new($mbi2 / $mbi);     # = 2
 
 Beware also of the order of more complicated expressions like:
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Math-BigInt-1.999703/t/objectify_mbf.t 
new/Math-BigInt-1.999704/t/objectify_mbf.t
--- old/Math-BigInt-1.999703/t/objectify_mbf.t  1970-01-01 01:00:00.000000000 
+0100
+++ new/Math-BigInt-1.999704/t/objectify_mbf.t  2015-09-25 15:14:16.000000000 
+0200
@@ -0,0 +1,90 @@
+#!perl
+#
+# Verify that objectify() is able to convert a "foreign" object into what we
+# want, when what we want is Math::BigFloat or subclass thereof.
+
+use strict;
+use warnings;
+
+package main;
+
+use Test::More tests => 6;
+
+use Math::BigFloat;
+
+###############################################################################
+
+for my $class ('Math::BigFloat', 'Math::BigFloat::Subclass') {
+
+    # This object defines what we want.
+
+    my $float = $class -> new(10);
+
+    # Create various objects that should work with the object above after
+    # objectify() has done its thing.
+
+    my $float_percent1 = My::Percent::Float1 -> new(100);
+    is($float * $float_percent1, 10);
+
+    my $float_percent2 = My::Percent::Float2 -> new(100);
+    is($float * $float_percent2, 10);
+
+    my $float_percent3 = My::Percent::Float3 -> new(100);
+    is($float * $float_percent3, 10);
+}
+
+###############################################################################
+# Class supports as_float(), which returns a Math::BigFloat.
+
+package My::Percent::Float1;
+
+sub new {
+    my $class = shift;
+    my $num = shift;
+    return bless \$num, $class;
+}
+
+sub as_float {
+    my $self = shift;
+    return Math::BigFloat -> new($$self / 100);
+}
+
+###############################################################################
+# Class supports as_float(), which returns a scalar.
+
+package My::Percent::Float2;
+
+sub new {
+    my $class = shift;
+    my $num = shift;
+    return bless \$num, $class;
+}
+
+sub as_float {
+    my $self = shift;
+    return $$self / 100;
+}
+
+###############################################################################
+# Class does not support as_float().
+
+package My::Percent::Float3;
+
+use overload '""' => sub { $_[0] -> as_string(); };
+
+sub new {
+    my $class = shift;
+    my $num = shift;
+    return bless \$num, $class;
+}
+
+sub as_string {
+    my $self = shift;
+    return $$self / 100;
+}
+
+###############################################################################
+
+package Math::BigFloat::Subclass;
+
+use base 'Math::BigFloat';
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Math-BigInt-1.999703/t/objectify_mbi.t 
new/Math-BigInt-1.999704/t/objectify_mbi.t
--- old/Math-BigInt-1.999703/t/objectify_mbi.t  1970-01-01 01:00:00.000000000 
+0100
+++ new/Math-BigInt-1.999704/t/objectify_mbi.t  2015-09-25 15:14:16.000000000 
+0200
@@ -0,0 +1,130 @@
+#!perl
+#
+# Verify that objectify() is able to convert a "foreign" object into what we
+# want, when what we want is Math::BigInt or subclass thereof.
+
+use strict;
+use warnings;
+
+package main;
+
+use Test::More tests => 10;
+
+use Math::BigInt;
+
+###############################################################################
+
+for my $class ('Math::BigInt', 'Math::BigInt::Subclass') {
+
+    # This object defines what we want.
+
+    my $int = $class -> new(10);
+
+    # Create various objects that should work with the object above after
+    # objectify() has done its thing.
+
+    my $int_percent1 = My::Percent::Int1 -> new(100);
+    is($int * $int_percent1, 10);
+
+    my $int_percent2 = My::Percent::Int2 -> new(100);
+    is($int * $int_percent2, 10);
+
+    my $int_percent3 = My::Percent::Int3 -> new(100);
+    is($int * $int_percent3, 10);
+
+    my $int_percent4 = My::Percent::Int4 -> new(100);
+    is($int * $int_percent4, 10);
+
+    my $int_percent5 = My::Percent::Int5 -> new(100);
+    is($int * $int_percent5, 10);
+}
+
+###############################################################################
+# Class supports as_int(), which returns a Math::BigInt.
+
+package My::Percent::Int1;
+
+sub new {
+    my $class = shift;
+    my $num = shift;
+    return bless \$num, $class;
+}
+
+sub as_int {
+    my $self = shift;
+    return Math::BigInt -> new($$self / 100);
+}
+
+###############################################################################
+# Class supports as_int(), which returns a scalar.
+
+package My::Percent::Int2;
+
+sub new {
+    my $class = shift;
+    my $num = shift;
+    return bless \$num, $class;
+}
+
+sub as_int {
+    my $self = shift;
+    return $$self / 100;
+}
+
+###############################################################################
+# Class does not support as_int(), but supports as_number(), which returns a
+# Math::BigInt.
+
+package My::Percent::Int3;
+
+sub new {
+    my $class = shift;
+    my $num = shift;
+    return bless \$num, $class;
+}
+
+sub as_number {
+    my $self = shift;
+    return Math::BigInt -> new($$self / 100);
+}
+
+###############################################################################
+# Class does  not support as_int(),  but supports as_number(), which  returns a
+# scalar.
+
+package My::Percent::Int4;
+
+sub new {
+    my $class = shift;
+    my $num = shift;
+    return bless \$num, $class;
+}
+
+sub as_number {
+    my $self = shift;
+    return $$self / 100;
+}
+
+###############################################################################
+# Class supports neither as_int() or as_number().
+
+package My::Percent::Int5;
+
+use overload '""' => sub { $_[0] -> as_string(); };
+
+sub new {
+    my $class = shift;
+    my $num = shift;
+    return bless \$num, $class;
+}
+
+sub as_string {
+    my $self = shift;
+    return $$self / 100;
+}
+
+###############################################################################
+
+package Math::BigInt::Subclass;
+
+use base 'Math::BigInt';


Reply via email to