This adds an ROK check after calling sv_derived_from, as the latter
also works for class names. It is done after sv_derived_from, rather
than before, as sv_derived_from calls get-magic.
package arybase;
-our $VERSION = "0.01";
+our $VERSION = "0.02";
require XSLoader;
XSLoader::load(); # This returns true, which makes require happy.
}
}
+eval { version->new("version") };
+pass('no crash with version->new("version")');
+{
+ package _102586;
+ sub TIESCALAR { bless [] }
+ sub FETCH { "version" }
+ sub STORE { }
+ tie my $v, __PACKAGE__;
+ $v = version->new(1);
+ eval { version->new($v) };
+}
+pass('no crash with version->new($tied) where $tied returns "version"');
+
1;
__DATA__
dVAR;
SV * const rv = newSV(0);
PERL_ARGS_ASSERT_NEW_VERSION;
- if ( sv_derived_from(ver,"version") ) /* can just copy directly */
+ if ( sv_derived_from(ver,"version") && SvROK(ver) )
+ /* can just copy directly */
{
I32 key;
AV * const av = newAV();