Subject: | relying on UNIVERSAL::isa is not safe in recent perls |
UNIVERSAL::isa's behavior is now more correct, meaning different, meaning Email::MIME::CreateHTML fails tests. To determine whether something is an object, use Scalar::Util::blessed. I believe this bug is the same as #85953.
I have attached a patch.
--
rjbs
Subject: | 0001-use-blessed-not-UNIVERSAL-isa-to-test-objecthood.patch |
From 52a0848ce4c2fd3133fd2cdc662c3c2e72b13dc7 Mon Sep 17 00:00:00 2001
From: Ricardo Signes <rjbs@cpan.org>
Date: Tue, 5 Nov 2013 09:53:21 -0500
Subject: [PATCH] use blessed, not UNIVERSAL::isa, to test objecthood
Without this, we fail on more recent perls, where things are
considered to be isa(UNIVERSAL) much more often (and reliably).
---
lib/Email/MIME/CreateHTML/Resolver.pm | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/Email/MIME/CreateHTML/Resolver.pm b/lib/Email/MIME/CreateHTML/Resolver.pm
index e5dd2b1..94cb271 100644
--- a/lib/Email/MIME/CreateHTML/Resolver.pm
+++ b/lib/Email/MIME/CreateHTML/Resolver.pm
@@ -9,6 +9,7 @@ package Email::MIME::CreateHTML::Resolver;
use strict;
use Carp;
+use Scalar::Util ();
use vars qw($VERSION $HaveCache $HaveLWP $HaveFilesystem);
$VERSION = sprintf "%d.%03d", q$Revision: 1.5 $ =~ /: (\d+)\.(\d+)/;
@@ -43,13 +44,13 @@ sub new {
#Do some sanity checking of inputs
my $resolver = $args->{resolver};
if(defined $resolver) {
- confess "resolver must be an object" unless ( UNIVERSAL::isa($resolver,'UNIVERSAL') );
+ confess "resolver must be an object" unless Scalar::Util::blessed($resolver);
confess "resolver does not seem to use the expected interface (get_resource)" unless ($resolver->can('get_resource'));
}
my $object_cache = $args->{'object_cache'};
if(defined $object_cache ) {
- confess "object_cache must be an object" unless ( UNIVERSAL::isa($object_cache,'UNIVERSAL') );
+ confess "object_cache must be an object" unless Scalar::Util::blessed($object_cache);
confess "object_cache does not seem to use the expected cache interface (get and set methods)"
unless ($object_cache->can('get') && $object_cache->can('set'));
warn("Caching support is not available - object_cache will not be used") unless($HaveCache);
--
1.8.4.1