New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH] CPAN RT 96254 and 96329: Correct the handling of subclasses #13931
Comments
From @pjacklamThis patch fixes two related CPAN RTs. Without this patch, I can reproduce the error, without the patch, everything looks fine. |
From @pjacklam0001-CPAN-RT-96254-and-96329-Correct-the-handling-of-subc.patchFrom 0ab501997776ffa2c34bbfbf50a0286ecab46e21 Mon Sep 17 00:00:00 2001
From: pjacklam <pjacklam@gmail.com>
Date: Sun, 15 Jun 2014 18:46:52 +0200
Subject: [PATCH] CPAN RT 96254 and 96329: Correct the handling of subclasses.
Don't check for an exact class name; trust inheritance.
---
dist/Math-BigInt/lib/Math/BigInt.pm | 18 ++++++------------
1 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/dist/Math-BigInt/lib/Math/BigInt.pm b/dist/Math-BigInt/lib/Math/BigInt.pm
index 7dd3d41..6bcc13f 100644
--- a/dist/Math-BigInt/lib/Math/BigInt.pm
+++ b/dist/Math-BigInt/lib/Math/BigInt.pm
@@ -2675,28 +2675,22 @@ sub objectify {
for my $i (1 .. $count) {
my $ref = ref $a[$i];
- # If it is an object of the right class, all is fine.
-
- if ($ref eq $a[0]) {
- next;
- }
-
- # Don't do anything with undefs.
+ # Perl scalars are fed to the appropriate constructor.
- unless (defined($a[$i])) {
+ unless ($ref) {
+ $a[$i] = $a[0] -> new($a[$i]);
next;
}
- # Perl scalars are fed to the appropriate constructor.
+ # If it is an object of the right class, all is fine.
- unless ($ref) {
- $a[$i] = $a[0] -> new($a[$i]);
+ if ($ref -> isa($a[0])) {
next;
}
# Upgrading is OK, so skip further tests if the argument is upgraded.
- if (defined $up && $ref eq $up) {
+ if (defined $up && $ref -> isa($up)) {
next;
}
--
1.7.9
|
From @tonycozOn Tue Jun 17 01:40:08 2014, pjacklam wrote:
This patch uses a different email address to your usual patch address: From: pjacklam <pjacklam@gmail.com> Is that intentional? If not, I can amend to change it to your usual "Peter John Acklam <pjacklam@online.no>". Tony |
The RT System itself - Status changed from 'new' to 'open' |
From @pjacklamTony Cook via RT [perlbug-followup@perl.org]:
That was a mistanke on my part. Please change to pjacklam@online.no. Sorry for the inconvenience. Best regards, |
@tonycoz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#122118 (status was 'resolved')
Searchable as RT122118$
The text was updated successfully, but these errors were encountered: